From 7844a40046d5e7018f12d0157ec08009d8c70aff Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Thu, 18 Oct 2018 15:26:20 -0400 Subject: [PATCH] Update some cliconf plugins (#47141) * Add `check_all` to many community cliconf plugins --- lib/ansible/plugins/cliconf/aireos.py | 6 +++--- lib/ansible/plugins/cliconf/aruba.py | 4 ++-- lib/ansible/plugins/cliconf/asa.py | 4 ++-- lib/ansible/plugins/cliconf/ce.py | 4 ++-- lib/ansible/plugins/cliconf/cnos.py | 2 +- lib/ansible/plugins/cliconf/dellos10.py | 4 ++-- lib/ansible/plugins/cliconf/dellos6.py | 4 ++-- lib/ansible/plugins/cliconf/dellos9.py | 4 ++-- lib/ansible/plugins/cliconf/edgeos.py | 4 ++-- lib/ansible/plugins/cliconf/enos.py | 4 ++-- lib/ansible/plugins/cliconf/exos.py | 4 ++-- lib/ansible/plugins/cliconf/ironware.py | 4 ++-- lib/ansible/plugins/cliconf/nos.py | 4 ++-- lib/ansible/plugins/cliconf/onyx.py | 4 ++-- lib/ansible/plugins/cliconf/routeros.py | 4 ++-- lib/ansible/plugins/cliconf/slxos.py | 4 ++-- lib/ansible/plugins/cliconf/voss.py | 9 ++------- 17 files changed, 34 insertions(+), 39 deletions(-) diff --git a/lib/ansible/plugins/cliconf/aireos.py b/lib/ansible/plugins/cliconf/aireos.py index 1496977832d..39dd92ddfd3 100644 --- a/lib/ansible/plugins/cliconf/aireos.py +++ b/lib/ansible/plugins/cliconf/aireos.py @@ -24,7 +24,7 @@ import json from itertools import chain -from ansible.module_utils._text import to_bytes, to_text +from ansible.module_utils._text import to_text from ansible.module_utils.network.common.utils import to_list from ansible.plugins.cliconf import CliconfBase, enable_mode @@ -69,8 +69,8 @@ class Cliconf(CliconfBase): for cmd in chain([b'config'], to_list(command), [b'end']): self.send_command(cmd) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/aruba.py b/lib/ansible/plugins/cliconf/aruba.py index 580e20580ca..52fd798a1c4 100644 --- a/lib/ansible/plugins/cliconf/aruba.py +++ b/lib/ansible/plugins/cliconf/aruba.py @@ -70,8 +70,8 @@ class Cliconf(CliconfBase): for cmd in chain([b'configure terminal'], to_list(command), [b'end']): self.send_command(cmd) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/asa.py b/lib/ansible/plugins/cliconf/asa.py index 575c9745449..04c42af13ae 100644 --- a/lib/ansible/plugins/cliconf/asa.py +++ b/lib/ansible/plugins/cliconf/asa.py @@ -67,8 +67,8 @@ class Cliconf(CliconfBase): for cmd in chain([b'configure terminal'], to_list(command), [b'end']): self.send_command(cmd) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/ce.py b/lib/ansible/plugins/cliconf/ce.py index 1dea8bf9fa9..cbd94fd23a7 100644 --- a/lib/ansible/plugins/cliconf/ce.py +++ b/lib/ansible/plugins/cliconf/ce.py @@ -82,8 +82,8 @@ class Cliconf(CliconfBase): results.append(self.send_command(command, prompt, answer, False, newline)) return results[1:-1] - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/cnos.py b/lib/ansible/plugins/cliconf/cnos.py index 3583b0026ab..573c90e68e8 100644 --- a/lib/ansible/plugins/cliconf/cnos.py +++ b/lib/ansible/plugins/cliconf/cnos.py @@ -81,7 +81,7 @@ class Cliconf(CliconfBase): self.send_command(cmd) def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/dellos10.py b/lib/ansible/plugins/cliconf/dellos10.py index f5ea7ec487f..a2d8e9b03dd 100644 --- a/lib/ansible/plugins/cliconf/dellos10.py +++ b/lib/ansible/plugins/cliconf/dellos10.py @@ -71,8 +71,8 @@ class Cliconf(CliconfBase): for cmd in chain(['configure terminal'], to_list(command), ['end']): self.send_command(to_bytes(cmd)) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/dellos6.py b/lib/ansible/plugins/cliconf/dellos6.py index 6952e02dba3..80d8ba92d1a 100644 --- a/lib/ansible/plugins/cliconf/dellos6.py +++ b/lib/ansible/plugins/cliconf/dellos6.py @@ -71,8 +71,8 @@ class Cliconf(CliconfBase): for cmd in chain([b'configure terminal'], to_list(command), [b'end']): self.send_command(cmd) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/dellos9.py b/lib/ansible/plugins/cliconf/dellos9.py index 96815ca84e3..1f56587ce25 100644 --- a/lib/ansible/plugins/cliconf/dellos9.py +++ b/lib/ansible/plugins/cliconf/dellos9.py @@ -71,8 +71,8 @@ class Cliconf(CliconfBase): for cmd in chain([b'configure terminal'], to_list(command), [b'end']): self.send_command(cmd) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/edgeos.py b/lib/ansible/plugins/cliconf/edgeos.py index 0057fb2fee3..1d187266b22 100644 --- a/lib/ansible/plugins/cliconf/edgeos.py +++ b/lib/ansible/plugins/cliconf/edgeos.py @@ -45,8 +45,8 @@ class Cliconf(CliconfBase): for cmd in chain(['configure'], to_list(candidate)): self.send_command(cmd) - def get(self, command=None, prompt=None, answer=None, sendonly=False, output=None): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def commit(self, comment=None): if comment: diff --git a/lib/ansible/plugins/cliconf/enos.py b/lib/ansible/plugins/cliconf/enos.py index d8506cf724f..16a22835406 100644 --- a/lib/ansible/plugins/cliconf/enos.py +++ b/lib/ansible/plugins/cliconf/enos.py @@ -67,8 +67,8 @@ class Cliconf(CliconfBase): for cmd in chain([b'configure terminal'], to_list(command), [b'end']): self.send_command(cmd) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/exos.py b/lib/ansible/plugins/cliconf/exos.py index 4fd1bea42a0..239685033ef 100644 --- a/lib/ansible/plugins/cliconf/exos.py +++ b/lib/ansible/plugins/cliconf/exos.py @@ -87,8 +87,8 @@ class Cliconf(CliconfBase): self.send_command(to_bytes(command), to_bytes(prompt), to_bytes(answer), False, newline) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_device_operations(self): return { diff --git a/lib/ansible/plugins/cliconf/ironware.py b/lib/ansible/plugins/cliconf/ironware.py index 6a7ed2cf33b..463b826043c 100644 --- a/lib/ansible/plugins/cliconf/ironware.py +++ b/lib/ansible/plugins/cliconf/ironware.py @@ -70,8 +70,8 @@ class Cliconf(CliconfBase): for cmd in chain([b'configure terminal'], to_list(command), [b'end']): self.send_command(cmd) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/nos.py b/lib/ansible/plugins/cliconf/nos.py index 7f39ad13fb5..4eaa74fc80d 100644 --- a/lib/ansible/plugins/cliconf/nos.py +++ b/lib/ansible/plugins/cliconf/nos.py @@ -95,8 +95,8 @@ class Cliconf(CliconfBase): resp['response'] = results return resp - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/onyx.py b/lib/ansible/plugins/cliconf/onyx.py index 6754a7a6bf8..668c9d5e001 100644 --- a/lib/ansible/plugins/cliconf/onyx.py +++ b/lib/ansible/plugins/cliconf/onyx.py @@ -59,8 +59,8 @@ class Cliconf(CliconfBase): for cmd in chain([b'configure terminal'], to_list(command), [b'exit']): self.send_command(cmd) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/routeros.py b/lib/ansible/plugins/cliconf/routeros.py index 6f88bce179d..d0d77a31b9e 100644 --- a/lib/ansible/plugins/cliconf/routeros.py +++ b/lib/ansible/plugins/cliconf/routeros.py @@ -67,8 +67,8 @@ class Cliconf(CliconfBase): def edit_config(self, command): return - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/slxos.py b/lib/ansible/plugins/cliconf/slxos.py index d34c1d03bb2..7065f91d375 100644 --- a/lib/ansible/plugins/cliconf/slxos.py +++ b/lib/ansible/plugins/cliconf/slxos.py @@ -87,8 +87,8 @@ class Cliconf(CliconfBase): self.send_command(command, prompt, answer, False, newline) - def get(self, command, prompt=None, answer=None, sendonly=False): - return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_capabilities(self): result = {} diff --git a/lib/ansible/plugins/cliconf/voss.py b/lib/ansible/plugins/cliconf/voss.py index 525fe31974c..83e51677b49 100644 --- a/lib/ansible/plugins/cliconf/voss.py +++ b/lib/ansible/plugins/cliconf/voss.py @@ -142,13 +142,8 @@ class Cliconf(CliconfBase): resp['response'] = results return resp - def get(self, command=None, prompt=None, answer=None, sendonly=False, output=None): - if not command: - raise ValueError('must provide value of command to execute') - if output: - raise ValueError("'output' value %s is not supported for get" % output) - - return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly) + def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): + return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all) def get_device_info(self): device_info = {}