summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Nečas <necas.marty@gmail.com>2019-11-12 20:03:31 +0100
committerMatt Clay <matt@mystile.com>2019-11-12 11:03:31 -0800
commit870294b2edcb5d0dce7934d10e7748bf375f14f8 (patch)
tree3d2bacd3b3896fade19425505f5b46597091439e
parent93d9a091a3ffe285e01610de4a14fa2263b8cc1a (diff)
downloadansible-870294b2edcb5d0dce7934d10e7748bf375f14f8.tar.gz
Ovirt host network dict correct backport (#64444)
* Ovirt host network dict correct (#64437) * ovirt_host_network: correct comparing of two dicts * update mode_number for 4th option * add changelog * add changelog
-rw-r--r--changelogs/fragments/64437-ovirt_host_network-correct-dict-check.yml2
-rw-r--r--lib/ansible/modules/cloud/ovirt/ovirt_host_network.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/changelogs/fragments/64437-ovirt_host_network-correct-dict-check.yml b/changelogs/fragments/64437-ovirt_host_network-correct-dict-check.yml
new file mode 100644
index 0000000000..f3a8f3cc53
--- /dev/null
+++ b/changelogs/fragments/64437-ovirt_host_network-correct-dict-check.yml
@@ -0,0 +1,2 @@
+bugfixes:
+- "ovirt_host_network: correct dictionary check."
diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_host_network.py b/lib/ansible/modules/cloud/ovirt/ovirt_host_network.py
index 7c78cbad7e..3f60ca6885 100644
--- a/lib/ansible/modules/cloud/ovirt/ovirt_host_network.py
+++ b/lib/ansible/modules/cloud/ovirt/ovirt_host_network.py
@@ -214,7 +214,7 @@ def get_bond_options(mode, usr_opts):
None,
'Dynamic link aggregation (802.3ad)',
]
- if (not 0 < mode_number <= len(modes) - 1):
+ if (not 0 < mode_number <= len(modes)):
return None
return modes[mode_number - 1]
@@ -245,7 +245,9 @@ def get_bond_options(mode, usr_opts):
class HostNetworksModule(BaseModule):
def __compare_options(self, new_options, old_options):
- return sorted(get_dict_of_struct(opt) for opt in new_options) != sorted(get_dict_of_struct(opt) for opt in old_options)
+ return sorted((get_dict_of_struct(opt) for opt in new_options),
+ key=lambda x: x["name"]) != sorted((get_dict_of_struct(opt) for opt in old_options),
+ key=lambda x: x["name"])
def build_entity(self):
return otypes.Host()