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.
pull/16496/head
Peter Sprygada 10 years ago
parent 3489dcfd94
commit b70d83fe1d

@ -227,11 +227,22 @@ class NetworkConfig(object):
updates.extend(config) updates.extend(config)
break break
updates = self.expand(updates)
if self._device_os == 'junos': if self._device_os == 'junos':
return updates 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)] return [item.text for item in self.expand(updates)]
def _build_children(self, children, parents=None, offset=0): def _build_children(self, children, parents=None, offset=0):

Loading…
Cancel
Save