1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Update some cliconf plugins (#47141)

* Add `check_all` to many community cliconf plugins
This commit is contained in:
Nathaniel Case 2018-10-18 15:26:20 -04:00 committed by GitHub
parent 096717edc5
commit 7844a40046
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 34 additions and 39 deletions

View file

@ -24,7 +24,7 @@ import json
from itertools import chain 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.module_utils.network.common.utils import to_list
from ansible.plugins.cliconf import CliconfBase, enable_mode 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']): for cmd in chain([b'config'], to_list(command), [b'end']):
self.send_command(cmd) self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -70,8 +70,8 @@ class Cliconf(CliconfBase):
for cmd in chain([b'configure terminal'], to_list(command), [b'end']): for cmd in chain([b'configure terminal'], to_list(command), [b'end']):
self.send_command(cmd) self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -67,8 +67,8 @@ class Cliconf(CliconfBase):
for cmd in chain([b'configure terminal'], to_list(command), [b'end']): for cmd in chain([b'configure terminal'], to_list(command), [b'end']):
self.send_command(cmd) self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -82,8 +82,8 @@ class Cliconf(CliconfBase):
results.append(self.send_command(command, prompt, answer, False, newline)) results.append(self.send_command(command, prompt, answer, False, newline))
return results[1:-1] return results[1:-1]
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -81,7 +81,7 @@ class Cliconf(CliconfBase):
self.send_command(cmd) self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False): 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): def get_capabilities(self):
result = {} result = {}

View file

@ -71,8 +71,8 @@ class Cliconf(CliconfBase):
for cmd in chain(['configure terminal'], to_list(command), ['end']): for cmd in chain(['configure terminal'], to_list(command), ['end']):
self.send_command(to_bytes(cmd)) self.send_command(to_bytes(cmd))
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -71,8 +71,8 @@ class Cliconf(CliconfBase):
for cmd in chain([b'configure terminal'], to_list(command), [b'end']): for cmd in chain([b'configure terminal'], to_list(command), [b'end']):
self.send_command(cmd) self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -71,8 +71,8 @@ class Cliconf(CliconfBase):
for cmd in chain([b'configure terminal'], to_list(command), [b'end']): for cmd in chain([b'configure terminal'], to_list(command), [b'end']):
self.send_command(cmd) self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -45,8 +45,8 @@ class Cliconf(CliconfBase):
for cmd in chain(['configure'], to_list(candidate)): for cmd in chain(['configure'], to_list(candidate)):
self.send_command(cmd) self.send_command(cmd)
def get(self, command=None, prompt=None, answer=None, sendonly=False, output=None): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def commit(self, comment=None): def commit(self, comment=None):
if comment: if comment:

View file

@ -67,8 +67,8 @@ class Cliconf(CliconfBase):
for cmd in chain([b'configure terminal'], to_list(command), [b'end']): for cmd in chain([b'configure terminal'], to_list(command), [b'end']):
self.send_command(cmd) self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -87,8 +87,8 @@ class Cliconf(CliconfBase):
self.send_command(to_bytes(command), to_bytes(prompt), to_bytes(answer), self.send_command(to_bytes(command), to_bytes(prompt), to_bytes(answer),
False, newline) False, newline)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_device_operations(self): def get_device_operations(self):
return { return {

View file

@ -70,8 +70,8 @@ class Cliconf(CliconfBase):
for cmd in chain([b'configure terminal'], to_list(command), [b'end']): for cmd in chain([b'configure terminal'], to_list(command), [b'end']):
self.send_command(cmd) self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -95,8 +95,8 @@ class Cliconf(CliconfBase):
resp['response'] = results resp['response'] = results
return resp return resp
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -59,8 +59,8 @@ class Cliconf(CliconfBase):
for cmd in chain([b'configure terminal'], to_list(command), [b'exit']): for cmd in chain([b'configure terminal'], to_list(command), [b'exit']):
self.send_command(cmd) self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -67,8 +67,8 @@ class Cliconf(CliconfBase):
def edit_config(self, command): def edit_config(self, command):
return return
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -87,8 +87,8 @@ class Cliconf(CliconfBase):
self.send_command(command, prompt, answer, False, newline) self.send_command(command, prompt, answer, False, newline)
def get(self, command, prompt=None, answer=None, sendonly=False): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly) return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def get_capabilities(self): def get_capabilities(self):
result = {} result = {}

View file

@ -142,13 +142,8 @@ class Cliconf(CliconfBase):
resp['response'] = results resp['response'] = results
return resp return resp
def get(self, command=None, prompt=None, answer=None, sendonly=False, output=None): def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):
if not command: return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
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_device_info(self): def get_device_info(self):
device_info = {} device_info = {}