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

AttributeError: 'NoneType' object has no attribute 'group' #115

Open
wukaiying opened this issue Nov 17, 2017 · 1 comment
Open

AttributeError: 'NoneType' object has no attribute 'group' #115

wukaiying opened this issue Nov 17, 2017 · 1 comment

Comments

@wukaiying
Copy link

when i run this command sudo kubespray prepare --nodes node1[ansible_ssh_host=192.168.33.111] node2[ansible_ssh_host=192.168.33.112] node3[ansible_ssh_host=192.168.33.113] [--etcds N+] [--masters N+]

Traceback (most recent call last):
File "/bin/kubespray", line 422, in
args.func(config)
File "/bin/kubespray", line 42, in prepare
options['etcds_list']
File "/usr/lib/python2.7/site-packages/kubespray/inventory.py", line 221, in write_inventory
inventory = self.format_inventory(masters, nodes, etcds)
File "/usr/lib/python2.7/site-packages/kubespray/inventory.py", line 194, in format_inventory
inventory_hostname = r.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

my env:
python --version
Python 2.7.5

ansible --version
ansible 2.4.1.0
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Nov 20 2015, 02:00:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]

@makuk66
Copy link

makuk66 commented Nov 24, 2017

I imagine you based that command on the instructions https://github.com/kubespray/kubespray-cli/blob/master/README.md#generate-inventory-for-a-baremetal-cluster? That line is misleading: the brackets in the --etcds and --masters options indicate that they are optional; unlike the brackets in the node specification which are part of the syntax. So with the command you used, the code is expecting a node[ansible_ssh_host=something], tries to parse out the bit before the bracket, which is empty, and falls over.

The question then becomes, what should those options be? The help text says:

  --masters N [N ...]   Number of masters, these instances will not run
                        workloads, master components only

which is unclear too: does it want a number (integer)? Multiple ones?
I believe what is needed is node names e.g.:

sudo kubespray prepare \
  --nodes node1[ansible_ssh_host=192.168.33.111] node2[ansible_ssh_host=192.168.33.112] node3[ansible_ssh_host=192.168.33.113] \
  --etcds node1 node2 node3 --masters node1

though I'm not entirely sure, as this is the first time I'm running this, but that at least got me further, and seems to generate plausible-looking yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants