diff --git a/changelogs/fragments/891-packet_net-fix-not-subscriptable.yaml b/changelogs/fragments/891-packet_net-fix-not-subscriptable.yaml new file mode 100644 index 0000000000..844a16eef0 --- /dev/null +++ b/changelogs/fragments/891-packet_net-fix-not-subscriptable.yaml @@ -0,0 +1,2 @@ +bugfixes: +- packet_net.py inventory script - fixed failure w.r.t. operating system retrieval by changing array subscription back to attribute access (https://github.com/ansible-collections/community.general/pull/891). diff --git a/scripts/inventory/packet_net.py b/scripts/inventory/packet_net.py index 9466017140..196e26869d 100644 --- a/scripts/inventory/packet_net.py +++ b/scripts/inventory/packet_net.py @@ -346,9 +346,9 @@ class PacketInventory(object): # Inventory: Group by OS if self.group_by_operating_system: - self.push(self.inventory, device.operating_system['slug'], dest) + self.push(self.inventory, device.operating_system.slug, dest) if self.nested_groups: - self.push_group(self.inventory, 'operating_systems', device.operating_system['slug']) + self.push_group(self.inventory, 'operating_systems', device.operating_system.slug) # Inventory: Group by plan type if self.group_by_plan_type: @@ -395,7 +395,7 @@ class PacketInventory(object): elif key == 'packet_facility': device_vars[key] = value['code'] elif key == 'packet_operating_system': - device_vars[key] = value['slug'] + device_vars[key] = value.slug elif key == 'packet_plan': device_vars[key] = value['slug'] elif key == 'packet_tags':