Fix Python 3 incompatibility in tripleo-ansible-inventory

When running under Python 3, the keys() method on a dict returns a
dict_keys object, not a list. The dict_keys object can't be indexed like
a list, so an exception is thrown. This patch switches from using the
keys() method to using list() on the dict instead, which returns a list
of the keys.

Change-Id: Ifb1814f2406318c4c42edc21581a6fc6d34eb91e
This commit is contained in:
James Slagle 2019-10-02 15:40:43 -04:00
parent 9f411bec5d
commit c8a490f25b
1 changed files with 1 additions and 1 deletions

View File

@ -153,7 +153,7 @@ def main():
host_network=configs.ssh_network,
serial=configs.serial)
inventory_keys = inventory_map.keys()
inventory_keys = list(inventory_map)
if len(inventory_keys) == 1:
inventory = inventory_map[inventory_keys[0]]
else: