[2.7] Update some cliconf plugins (#47141) (#47310)

* [2.7] Update some cliconf plugins (#47141)

* Add `check_all` to many community cliconf plugins
(cherry picked from commit 7844a40)

Co-authored-by: Nathaniel Case <this.is@nathanielca.se>

* Add changelog entry
This commit is contained in:
Nathaniel Case 2018-10-22 13:35:27 -04:00 committed by Toshio Kuratomi
parent f1db8985e3
commit 7d936c12fd
18 changed files with 40 additions and 39 deletions

View file

@ -0,0 +1,6 @@
---
bugfixes:
- Update the signatures of many cliconf plugins' get() methods to support the check_all paramter.
Specifically, aireos, aruba, asa, ce, cnos, dellos6, dellos9, dellos10,
edgeos, enos, exos, ironware, nos, onyx, routeros, slxos, and voss were
updated. This fixes the cli_command module for these platforms

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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:

View file

@ -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 = {}

View file

@ -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 {

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}

View file

@ -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 = {}