diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py | 24 | ||||
-rw-r--r-- | plugins/modules/vyos_l3_interface.py | 4 |
2 files changed, 17 insertions, 11 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"]) diff --git a/plugins/modules/vyos_l3_interface.py b/plugins/modules/vyos_l3_interface.py index 88b5a91..214022a 100644 --- a/plugins/modules/vyos_l3_interface.py +++ b/plugins/modules/vyos_l3_interface.py @@ -104,13 +104,13 @@ EXAMPLES = """ vyos.vyos.vyos_l3_interface: aggregate: - {name: eth1, ipv4: 192.168.2.10/24} - - {name: eth2, ipv4: 192.168.3.10/24, ipv6: fd5d:12c9:2201:1::1/64} + - {name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64"} - name: Remove IP addresses on aggregate vyos.vyos.vyos_l3_interface: aggregate: - {name: eth1, ipv4: 192.168.2.10/24} - - {name: eth2, ipv4: 192.168.3.10/24, ipv6: fd5d:12c9:2201:1::1/64} + - {name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64"} state: absent """ |