Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inventory does not accept tuples like 001-hostname,10.0.0.1 #11549

Open
adinst opened this issue Sep 17, 2024 · 0 comments
Open

Inventory does not accept tuples like 001-hostname,10.0.0.1 #11549

adinst opened this issue Sep 17, 2024 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@adinst
Copy link

adinst commented Sep 17, 2024

What happened?

calling inventory.py with 001-hostname,10.0.0.1 failed as the hostname starting with 001 is seen as ip-address.

Traceback (most recent call last):
File "/kubespray/contrib/inventory_builder/inventory.py", line 480, in
sys.exit(main())
File "/kubespray/contrib/inventory_builder/inventory.py", line 475, in main
KubesprayInventory(argv, CONFIG_FILE)
File "/kubespray/contrib/inventory_builder/inventory.py", line 119, in init
changed_hosts = self.range2ips(changed_hosts)
File "/kubespray/contrib/inventory_builder/inventory.py", line 286, in range2ips
start, end = host.strip().split('-')
ValueError: too many values to unpack (expected 2)

What did you expect to happen?

Expected to accept 001-hostname as a valid hostname and not seen it as an ip-address.

How can we reproduce it (as minimally and precisely as possible)?

inventory.py 001-hostname,10.0.0.1

OS

PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Version of Ansible

9.8.0

Version of Python

3.10.12

Version of Kubespray (commit)

4577ee4

Network plugin used

calico

Full inventory with variables

not available

Command used to invoke ansible

python3 contrib/inventory_builder/inventory.py

Output of ansible run

Traceback (most recent call last):
File "/kubespray/contrib/inventory_builder/inventory.py", line 480, in
sys.exit(main())
File "/kubespray/contrib/inventory_builder/inventory.py", line 475, in main
KubesprayInventory(argv, CONFIG_FILE)
File "/kubespray/contrib/inventory_builder/inventory.py", line 119, in init
changed_hosts = self.range2ips(changed_hosts)
File "/kubespray/contrib/inventory_builder/inventory.py", line 286, in range2ips
start, end = host.strip().split('-')
ValueError: too many values to unpack (expected 2)

Anything else we need to know

No response

@adinst adinst added the kind/bug Categorizes issue or PR as related to a bug. label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant