Skip to content

Commit

Permalink
Merge branch 'develop' into patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceaulinic authored Jul 9, 2019
2 parents d218dd5 + 17b7ba2 commit 5863e6a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/validate/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ CLI & Ansible
If you prefer, you can also make use of the validate functionality via the CLI with the command ``cl_napalm_validate`` or with ansible plugin. You can find more information about them here:

* CLI - https://github.com/napalm-automation/napalm/pull/168
* Ansible - https://github.com/napalm-automation/napalm-ansible/blob/master/library/napalm_validate.py
* Ansible - https://github.com/napalm-automation/napalm-ansible/blob/master/napalm_ansible/modules/napalm_validate.py


Why this and what's next
Expand Down
2 changes: 1 addition & 1 deletion napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def rollback(self):
if not self._check_file_exists(cfg_file):
raise ReplaceConfigException("Rollback config file does not exist")
cmd = "configure replace {} force".format(cfg_file)
self.device.send_command_expect(cmd)
self._commit_handler(cmd)

# After a rollback - we no longer know whether this is configured or not.
self.prompt_quiet_configured = None
Expand Down
8 changes: 6 additions & 2 deletions napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,15 @@ def commit_config(self, message=""):

if self.replace:
self._load_cfg_from_checkpoint()
# If hostname changes ensure Netmiko state is updated properly
self._netmiko_device.set_base_prompt()
else:
self._commit_merge()

try:
# If hostname changes ensure Netmiko state is updated properly
self._netmiko_device.set_base_prompt()
except AttributeError:
pass

self._copy_run_start()
self.loaded = False
else:
Expand Down
11 changes: 9 additions & 2 deletions napalm/nxos_ssh/nxos_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ def _copy_run_start(self):
raise CommandErrorException(msg)

def _load_cfg_from_checkpoint(self):

commands = [
"terminal dont-ask",
"rollback running-config file {}".format(self.candidate_cfg),
Expand All @@ -542,10 +543,16 @@ def _load_cfg_from_checkpoint(self):

def rollback(self):
if self.changed:
command = "rollback running-config file {}".format(self.rollback_cfg)
result = self._send_command(command)
commands = [
"terminal dont-ask",
"rollback running-config file {}".format(self.rollback_cfg),
"no terminal dont-ask",
]
result = self._send_command_list(commands, expect_string=r"[#>]")
if "completed" not in result.lower():
raise ReplaceConfigException(result)
# If hostname changes ensure Netmiko state is updated properly
self._netmiko_device.set_base_prompt()
self._copy_run_start()
self.changed = False

Expand Down

0 comments on commit 5863e6a

Please sign in to comment.