Skip to content

Commit

Permalink
adding fix for packet_net.py (#891) (#1396)
Browse files Browse the repository at this point in the history
* adding fix for packet_net.py

* adding changelog fragment

* squashing to fix cascading notifications

Apply suggestions from code review

thanks felixfontein for working with me!

Co-authored-by: Felix Fontein <felix@fontein.de>

adding suggestions from code review (accessing dict in a better way)

modified packet_net fragment to accurate description

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit cc7d0f7)

Co-authored-by: elreydetoda <unc741@gmail.com>
  • Loading branch information
patchback[bot] and elreydetoda authored Nov 26, 2020
1 parent 9e780b9 commit 9bb4396
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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).
6 changes: 3 additions & 3 deletions scripts/inventory/packet_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ def add_device(self, device, project):

# 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:
Expand Down Expand Up @@ -395,7 +395,7 @@ def get_host_info_dict_from_device(self, device):
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':
Expand Down

0 comments on commit 9bb4396

Please sign in to comment.