[PR #8895/0bf84ba2 backport][stable-9] fix comprehension (#8896)

fix comprehension (#8895)

* fix comprehension

* add changelog frag

* Update changelogs/fragments/8895-fix-comprehension.yaml

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

---------

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

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
pull/8903/head
patchback[bot] 2024-09-22 13:15:21 +03:00 committed by GitHub
parent 8152cb3e1f
commit 5ea44edc64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- lxd_container - fix bug introduced in previous commit (https://github.com/ansible-collections/community.general/pull/8895, https://github.com/ansible-collections/community.general/issues/8888).

View File

@ -618,7 +618,7 @@ class LXDContainerManagement(object):
data = (self._get_instance_state_json() or {}).get('metadata', None) or {}
network = {
k: v
for k, v in data.get('network', {}).items()
for k, v in (data.get('network') or {}).items()
if k not in ignore_devices
}
addresses = {
@ -768,7 +768,7 @@ class LXDContainerManagement(object):
self.old_instance_json = self._get_instance_json()
self.old_sections = {
section: adjust_content(content)
for section, content in self.old_instance_json.get('metadata', {}).items()
for section, content in (self.old_instance_json.get('metadata') or {}).items()
if section in set(CONFIG_PARAMS) - set(CONFIG_CREATION_PARAMS)
}