From 49f1760fea49f351ea48926ca98eea44a0decde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ne=C4=8Das?= Date: Tue, 12 Nov 2019 20:37:45 +0100 Subject: [PATCH] Ovirt correct resloving false atrs backport (#63953) * ovirt correct resolving nested atributes which are false (#63908) * add changelog --- .../63908-ovirt-correct-resolving-nested-atributes.yml | 2 ++ lib/ansible/module_utils/ovirt.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/63908-ovirt-correct-resolving-nested-atributes.yml diff --git a/changelogs/fragments/63908-ovirt-correct-resolving-nested-atributes.yml b/changelogs/fragments/63908-ovirt-correct-resolving-nested-atributes.yml new file mode 100644 index 00000000000..504433ffe0e --- /dev/null +++ b/changelogs/fragments/63908-ovirt-correct-resolving-nested-atributes.yml @@ -0,0 +1,2 @@ +bugfixes: +- "Ovirt correct resolving nested atributes which are false." diff --git a/lib/ansible/module_utils/ovirt.py b/lib/ansible/module_utils/ovirt.py index 6f0f380c668..9ae438e3321 100644 --- a/lib/ansible/module_utils/ovirt.py +++ b/lib/ansible/module_utils/ovirt.py @@ -69,7 +69,7 @@ def get_dict_of_struct(struct, connection=None, fetch_nested=False, attributes=N value = None nested_obj = dict( (attr, convert_value(getattr(value, attr))) - for attr in attributes if getattr(value, attr, None) + for attr in attributes if getattr(value, attr, None) is not None ) nested_obj['id'] = getattr(value, 'id', None) nested_obj['href'] = getattr(value, 'href', None)