diff options
author | Peter Sprygada <psprygada@ansible.com> | 2016-06-29 06:30:00 -0700 |
---|---|---|
committer | Peter Sprygada <psprygada@ansible.com> | 2016-06-29 06:30:00 -0700 |
commit | b70d83fe1d9f11f79b52b59e0125ab4ac4e1cd5a (patch) | |
tree | 96aac1a4f91a94822ada480790e733b6554c05f1 | |
parent | 3489dcfd94778c6f37ae691e940878899d8424f9 (diff) | |
download | ansible-b70d83fe1d9f11f79b52b59e0125ab4ac4e1cd5a.tar.gz |
fixes minor issue with expanding blocks in netcfg
This fixes a minor bug where blocks in netcfg where not being expanded
when replace=block was specified.
-rw-r--r-- | lib/ansible/module_utils/netcfg.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/ansible/module_utils/netcfg.py b/lib/ansible/module_utils/netcfg.py index d8055912f9..6d46637a0a 100644 --- a/lib/ansible/module_utils/netcfg.py +++ b/lib/ansible/module_utils/netcfg.py @@ -227,11 +227,22 @@ class NetworkConfig(object): updates.extend(config) break - updates = self.expand(updates) - if self._device_os == 'junos': return updates + changes = list() + for update in updates: + if replace == 'block': + if update.parents: + changes.append(update.parents[-1]) + for child in update.parents[-1].children: + changes.append(child) + else: + changes.append(update) + else: + changes.append(update) + updates = self.expand(changes) + return [item.text for item in self.expand(updates)] def _build_children(self, children, parents=None, offset=0): |