diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:18:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:18:37 +0000 |
commit | 5d7eda1e172f8e396536a8fbd6f85b4b991290e8 (patch) | |
tree | b18be36b43a1abdab0d40ecc8e4c8de2dbcd65c0 /ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py | |
parent | Adding debian version 9.5.1+dfsg-1. (diff) | |
download | ansible-5d7eda1e172f8e396536a8fbd6f85b4b991290e8.tar.xz ansible-5d7eda1e172f8e396536a8fbd6f85b4b991290e8.zip |
Merging upstream version 10.0.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py')
-rw-r--r-- | ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py b/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py index 6b569ae2a..8a4e8a850 100644 --- a/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py +++ b/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py @@ -358,6 +358,15 @@ class Cliconf(CliconfBase): resp["response"] = results return resp + def restore(self, filename=None, path=""): + if not filename: + raise ValueError("'file_name' value is required for restore") + self.configure() + cmd = f"load {path}{filename}" + resp = self.send_command(cmd) + self.commit() + return resp + def get_diff( self, candidate=None, @@ -452,7 +461,9 @@ class Cliconf(CliconfBase): if self.get_option("commit_confirmed"): cmd_obj["command"] = "commit replace confirmed" if self.get_option("commit_confirmed_timeout"): - cmd_obj["command"] += " {0}".format(self.get_option("commit_confirmed_timeout")) + cmd_obj["command"] += " {0}".format( + self.get_option("commit_confirmed_timeout"), + ) cmd_obj[ "prompt" @@ -462,11 +473,17 @@ class Cliconf(CliconfBase): elif self.get_option("commit_confirmed"): cmd_obj["command"] = "commit confirmed" if self.get_option("commit_confirmed_timeout"): - cmd_obj["command"] += " {0}".format(self.get_option("commit_confirmed_timeout")) + cmd_obj["command"] += " {0}".format( + self.get_option("commit_confirmed_timeout"), + ) if self.get_option("commit_label"): - cmd_obj["command"] += " label {0}".format(self.get_option("commit_label")) + cmd_obj["command"] += " label {0}".format( + self.get_option("commit_label"), + ) if self.get_option("commit_comment"): - cmd_obj["command"] += " comment {0}".format(self.get_option("commit_comment")) + cmd_obj["command"] += " comment {0}".format( + self.get_option("commit_comment"), + ) else: label = label or self.get_option("commit_label") @@ -498,7 +515,9 @@ class Cliconf(CliconfBase): output = cmd.pop("output", None) if output: - raise ValueError("'output' value %s is not supported for run_commands" % output) + raise ValueError( + "'output' value %s is not supported for run_commands" % output, + ) try: out = self.send_command(**cmd) |