You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the group_by_image_name configuration option is True, getting the inventory fails with a KeyError if a server has no boot device.
Expected Behaviour
Servers without boot device must be skipped in the generation of the image group.
Error Details
root@debian:/Ansible# profitbricks_inventory.py –i
Traceback (most recent call last):
File "/usr/local/lib/profitbricks-module-ansible/inventory/profitbricks_inventory.py", line 529, in <module>
ProfitBricksInventory()
File "/usr/local/lib/profitbricks-module-ansible/inventory/profitbricks_inventory.py", line 155, in __init__
self.build_inventory()
File "/usr/local/lib/profitbricks-module-ansible/inventory/profitbricks_inventory.py", line 414, in build_inventory
if image_key in boot_device['properties']:
KeyError: 'properties'
The cause is in the incomplete if/elif clause in line 407 to 413:
boot_device = {}
image_key = 'image'
if server['properties']['bootVolume'] is not None:
boot_device = server['properties']['bootVolume']
elif server['properties']['bootCdrom'] is not None:
boot_device = server['properties']['bootCdrom']
image_key = 'name'
The case that bootVolumeandbootCdrom are None is not considered.
Either an additional elif clause is needed or boot_device needs to be tested to avoid this error.
Note: group_by_licence_type does not run into this error because this case is tested too.
The text was updated successfully, but these errors were encountered:
jbuchhammer
changed the title
Dynamic inventory fails if a server has no boot volume
Dynamic inventory fails if a server has no boot device
May 20, 2019
Description
If the
group_by_image_name
configuration option is True, getting the inventory fails with a KeyError if a server has no boot device.Expected Behaviour
Servers without boot device must be skipped in the generation of the image group.
Error Details
The cause is in the incomplete if/elif clause in line 407 to 413:
The case that
bootVolume
andbootCdrom
areNone
is not considered.Either an additional elif clause is needed or
boot_device
needs to be tested to avoid this error.Note:
group_by_licence_type
does not run into this error because this case is tested too.The text was updated successfully, but these errors were encountered: