mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-02 11:22:47 +00:00
Change cliconf get() method signature with explicit args (#33341)
* Change cliconf get() method signature to explicit args instead of *args and **kwargs * updates doc string
This commit is contained in:
@@ -150,22 +150,16 @@ class CliconfBase(with_metaclass(ABCMeta, object)):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get(self, *args, **kwargs):
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
"""Execute specified command on remote device
|
||||
This method will retrieve the specified data and
|
||||
return it to the caller as a string.
|
||||
:args:
|
||||
arg[0] command: command in string format to be executed on remote device
|
||||
arg[1] prompt: the expected prompt generated by executing command.
|
||||
command: command in string format to be executed on remote device
|
||||
prompt: the expected prompt generated by executing command.
|
||||
This can be a string or a list of strings (optional)
|
||||
arg[2] answer: the string to respond to the prompt with (optional)
|
||||
arg[3] sendonly: bool to disable waiting for response, default is false (optional)
|
||||
:kwargs:
|
||||
:command: the command string to execute
|
||||
:prompt: the expected prompt generated by executing command.
|
||||
This can be a string or a list of strings
|
||||
:answer: the string to respond to the prompt with
|
||||
:sendonly: bool to disable waiting for response
|
||||
answer: the string to respond to the prompt with (optional)
|
||||
sendonly: bool to disable waiting for response, default is false (optional)
|
||||
:returns: Returns output received from remote device as byte string
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -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, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
|
||||
@@ -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, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
|
||||
@@ -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, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
|
||||
@@ -85,8 +85,8 @@ class Cliconf(CliconfBase):
|
||||
for cmd in chain([b'configure terminal'], to_list(command), [b'end']):
|
||||
self.send_command(cmd)
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
|
||||
@@ -62,8 +62,8 @@ class Cliconf(CliconfBase):
|
||||
for cmd in chain([b'configure'], to_list(command), [b'end']):
|
||||
self.send_command(cmd)
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
|
||||
@@ -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, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
|
||||
@@ -66,8 +66,8 @@ class Cliconf(CliconfBase):
|
||||
for cmd in chain([b'configure'], to_list(command), [b'end']):
|
||||
self.send_command(cmd)
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def commit(self, comment=None):
|
||||
if comment:
|
||||
|
||||
@@ -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, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
|
||||
@@ -69,12 +69,10 @@ class Cliconf(CliconfBase):
|
||||
for cmd in chain(['configure'], to_list(command)):
|
||||
self.send_command(cmd)
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
command = kwargs.get('command')
|
||||
return self.send_command(command)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def commit(self, *args, **kwargs):
|
||||
comment = kwargs.get('comment', None)
|
||||
def commit(self, comment=None):
|
||||
command = b'commit'
|
||||
if comment:
|
||||
command += b' comment {0}'.format(comment)
|
||||
|
||||
@@ -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, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
|
||||
@@ -51,8 +51,8 @@ class Cliconf(CliconfBase):
|
||||
for cmd in chain([b'configure'], to_list(command), [b'end']):
|
||||
self.send_command(cmd)
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
|
||||
@@ -58,8 +58,8 @@ class Cliconf(CliconfBase):
|
||||
for cmd in chain([b'configure'], to_list(command)):
|
||||
self.send_command(cmd)
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
return self.send_command(*args, **kwargs)
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
|
||||
def commit(self, comment=None):
|
||||
if comment:
|
||||
|
||||
Reference in New Issue
Block a user