From a347123a7880b1e32d3a2850b666fdf34be52821 Mon Sep 17 00:00:00 2001 From: Jared Dillard Date: Mon, 24 Jun 2019 17:33:07 -0700 Subject: [PATCH 1/2] Update link location in the docs (#1002) --- docs/validate/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/validate/index.rst b/docs/validate/index.rst index 601862072..a7e60af22 100644 --- a/docs/validate/index.rst +++ b/docs/validate/index.rst @@ -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 From 17b7ba270ad2ab22d8ca1a045d866ff99956fca5 Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Tue, 25 Jun 2019 13:28:34 -0700 Subject: [PATCH 2/2] Hostname fixes for NXOS and IOS (#1007) --- napalm/ios/ios.py | 2 +- napalm/nxos/nxos.py | 8 ++++++-- napalm/nxos_ssh/nxos_ssh.py | 11 +++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/napalm/ios/ios.py b/napalm/ios/ios.py index 602ac423a..01479e895 100644 --- a/napalm/ios/ios.py +++ b/napalm/ios/ios.py @@ -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 diff --git a/napalm/nxos/nxos.py b/napalm/nxos/nxos.py index bb5540b24..dee643c24 100644 --- a/napalm/nxos/nxos.py +++ b/napalm/nxos/nxos.py @@ -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: diff --git a/napalm/nxos_ssh/nxos_ssh.py b/napalm/nxos_ssh/nxos_ssh.py index 6d5a6b4cd..1eec8e6d7 100644 --- a/napalm/nxos_ssh/nxos_ssh.py +++ b/napalm/nxos_ssh/nxos_ssh.py @@ -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), @@ -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