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.
This commit is contained in:
Peter Sprygada 2016-06-29 06:30:00 -07:00
parent 3489dcfd94
commit b70d83fe1d

View file

@ -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):