mirror of
https://github.com/napalm-automation-community/napalm-vyos.git
synced 2026-09-22 12:11:15 +00:00
Fix for situation where config dont change
This commit is contained in:
@@ -95,17 +95,26 @@ class VyOSDriver(NetworkDriver):
|
|||||||
Only configuration files are supported with load_replace_candidate.
|
Only configuration files are supported with load_replace_candidate.
|
||||||
It must be a full config file like /config/config.boot
|
It must be a full config file like /config/config.boot
|
||||||
Due to the OS nature, we do not
|
Due to the OS nature, we do not
|
||||||
support a replace using a configuration string.
|
support a replace using a configuration string.
|
||||||
"""
|
"""
|
||||||
if filename is not None:
|
if filename is not None:
|
||||||
if os.path.exists(filename) == True:
|
if os.path.exists(filename) == True:
|
||||||
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