diff options
author | GomathiselviS <gomathiselvi@gmail.com> | 2021-02-18 15:26:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-18 20:26:33 +0000 |
commit | b739944aabe5d3c287a89544fc365382d2719070 (patch) | |
tree | c612c86a6913549c05ab813fd85744c6807b9c5c /plugins/module_utils | |
parent | 4e8356f7ae00e55ea7554b9c817141035e40826b (diff) | |
download | vyos.vyos-b739944aabe5d3c287a89544fc365382d2719070.tar.gz vyos.vyos-b739944aabe5d3c287a89544fc365382d2719070.zip |
Fix test-sanity-docker failures (#124)
Fix test-sanity-docker failures
Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
https://github.com/Qalthos
Diffstat (limited to 'plugins/module_utils')
-rw-r--r-- | plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py b/plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py index d01b1e0..c7590ee 100644 --- a/plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py +++ b/plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py @@ -76,8 +76,12 @@ class Ospf_interfaces(ResourceModule): """Generate configuration commands to send based on want, have and desired state. """ - wantd = {entry["name"]: entry for entry in self.want} - haved = {entry["name"]: entry for entry in self.have} + wantd = {} + haved = {} + for entry in self.want: + wantd.update({entry["name"]: entry}) + for entry in self.have: + haved.update({entry["name"]: entry}) # turn all lists of dicts into dicts prior to merge for entry in wantd, haved: @@ -88,9 +92,11 @@ class Ospf_interfaces(ResourceModule): # if state is deleted, empty out wantd and set haved to wantd if self.state == "deleted": - haved = { - k: v for k, v in iteritems(haved) if k in wantd or not wantd - } + h_del = {} + for k, v in iteritems(haved): + if k in wantd or not wantd: + h_del.update({k: v}) + haved = h_del have_int = [] for k, have in iteritems(haved): if k in wantd: @@ -157,8 +163,8 @@ class Ospf_interfaces(ResourceModule): def _ospf_int_list_to_dict(self, entry): for name, family in iteritems(entry): if "address_family" in family: - family["address_family"] = { - entry["afi"]: entry - for entry in family.get("address_family", []) - } + addr_dict = {} + for entry in family.get("address_family", []): + addr_dict.update({entry["afi"]: entry}) + family["address_family"] = addr_dict self._ospf_int_list_to_dict(family["address_family"]) |