fix bug 63761 (#63901)
This commit is contained in:
parent
548fa65ac6
commit
be1bcc7450
1 changed files with 17 additions and 4 deletions
|
@ -140,10 +140,11 @@ class Interfaces(ConfigBase):
|
|||
elif interface['name'] in each['name']:
|
||||
break
|
||||
else:
|
||||
# configuring non-existing interface
|
||||
commands.extend(self._set_config(interface, dict()))
|
||||
continue
|
||||
have_dict = filter_dict_having_none_value(interface, each)
|
||||
want = dict()
|
||||
commands.extend(self._clear_config(want, have_dict))
|
||||
commands.extend(self._clear_config(dict(), have_dict))
|
||||
commands.extend(self._set_config(interface, each))
|
||||
# Remove the duplicate interface call
|
||||
commands = remove_duplicate_interface(commands)
|
||||
|
@ -163,10 +164,12 @@ class Interfaces(ConfigBase):
|
|||
|
||||
for each in have:
|
||||
for interface in want:
|
||||
count = 0
|
||||
if each['name'] == interface['name']:
|
||||
break
|
||||
elif interface['name'] in each['name']:
|
||||
break
|
||||
count += 1
|
||||
else:
|
||||
# We didn't find a matching desired state, which means we can
|
||||
# pretend we recieved an empty desired state.
|
||||
|
@ -174,9 +177,17 @@ class Interfaces(ConfigBase):
|
|||
commands.extend(self._clear_config(interface, each))
|
||||
continue
|
||||
have_dict = filter_dict_having_none_value(interface, each)
|
||||
want = dict()
|
||||
commands.extend(self._clear_config(want, have_dict))
|
||||
commands.extend(self._clear_config(dict(), have_dict))
|
||||
commands.extend(self._set_config(interface, each))
|
||||
# as the pre-existing interface are now configured by
|
||||
# above set_config call, deleting the respective
|
||||
# interface entry from the want list
|
||||
del want[count]
|
||||
|
||||
# Iterating through want list which now only have new interfaces to be
|
||||
# configured
|
||||
for each in want:
|
||||
commands.extend(self._set_config(each, dict()))
|
||||
# Remove the duplicate interface call
|
||||
commands = remove_duplicate_interface(commands)
|
||||
|
||||
|
@ -198,6 +209,8 @@ class Interfaces(ConfigBase):
|
|||
if each['name'] == interface['name']:
|
||||
break
|
||||
else:
|
||||
# configuring non-existing interface
|
||||
commands.extend(self._set_config(interface, dict()))
|
||||
continue
|
||||
commands.extend(self._set_config(interface, each))
|
||||
|
||||
|
|
Loading…
Reference in a new issue