mirror of
https://github.com/napalm-automation-community/napalm-vyos.git
synced 2026-09-22 20:21:16 +00:00
Fix for situation where config dont change
This commit is contained in:
@@ -102,10 +102,19 @@ class VyOSDriver(NetworkDriver):
|
|||||||
self._scp_client.scp_transfer_file(filename, self._DEST_FILENAME)
|
self._scp_client.scp_transfer_file(filename, self._DEST_FILENAME)
|
||||||
print self._device.send_command("cp "+self._BOOT_FILENAME+" "+self._BACKUP_FILENAME)
|
print self._device.send_command("cp "+self._BOOT_FILENAME+" "+self._BACKUP_FILENAME)
|
||||||
output_loadcmd = self._device.send_config_set(['load '+self._DEST_FILENAME])
|
output_loadcmd = self._device.send_config_set(['load '+self._DEST_FILENAME])
|
||||||
match = re.findall("Load complete.", output_loadcmd)
|
match_loaded = re.findall("Load complete.", output_loadcmd)
|
||||||
if not match:
|
match_notchanged = re.findall("No configuration changes to commit", output_loadcmd)
|
||||||
|
match_failed = re.findall("Failed to parse specified config file", output_loadcmd)
|
||||||
|
|
||||||
|
if match_failed:
|
||||||
raise ReplaceConfigException("Failed replace config: "
|
raise ReplaceConfigException("Failed replace config: "
|
||||||
+output_loadcmd)
|
+output_loadcmd)
|
||||||
|
|
||||||
|
if not match_loaded:
|
||||||
|
if not match_notchanged:
|
||||||
|
raise ReplaceConfigException("Failed replace config: "
|
||||||
|
+output_loadcmd)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ReplaceConfigException("config file is not found")
|
raise ReplaceConfigException("config file is not found")
|
||||||
else:
|
else:
|
||||||
@@ -138,7 +147,7 @@ class VyOSDriver(NetworkDriver):
|
|||||||
match = re.findall("No changes between working and active configurations",
|
match = re.findall("No changes between working and active configurations",
|
||||||
output_compare)
|
output_compare)
|
||||||
if match:
|
if match:
|
||||||
return
|
return ""
|
||||||
else:
|
else:
|
||||||
return output_compare
|
return output_compare
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user