From 04b3d08d27c66e74b159b948b3f9560bd28f80f9 Mon Sep 17 00:00:00 2001 From: Alex Belytskyi Date: Thu, 21 Dec 2023 15:45:04 +0100 Subject: [PATCH] fixing safe configuration for Huawei VRPv8 --- netmiko/huawei/huawei.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/netmiko/huawei/huawei.py b/netmiko/huawei/huawei.py index 77750b3df..2ee80c607 100644 --- a/netmiko/huawei/huawei.py +++ b/netmiko/huawei/huawei.py @@ -104,12 +104,18 @@ def save_config( Configuration file had been saved successfully Note: The configuration file will take effect after being activated ###################################################################### + or + ###################################################################### + Warning: The current configuration will be written to the device. Continue? [Y/N]:y + Now saving the current configuration to the slot 1 . + Info: Save the configuration successfully. + ###################################################################### """ # Huawei devices might break if you try to use send_command_timing() so use send_command() # instead. if confirm: - pattern = rf"(?:Are you sure|{self.prompt_pattern})" + pattern = rf"(?:[Cc]ontinue\?|{self.prompt_pattern})" output = self._send_command_str( command_string=cmd, expect_string=pattern, @@ -117,7 +123,7 @@ def save_config( strip_command=False, read_timeout=100.0, ) - if confirm_response and "Are you sure" in output: + if confirm_response and re.search(r"[Cc]ontinue\?", output): output += self._send_command_str( command_string=confirm_response, expect_string=self.prompt_pattern, @@ -266,7 +272,3 @@ def commit( if error_marker in output: raise ValueError(f"Commit failed with following errors:\n\n{output}") return output - - def save_config(self, *args: Any, **kwargs: Any) -> str: - """Not Implemented""" - raise NotImplementedError