mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 06:30:19 -07:00
Vyos CliConf refactor (#33348)
* Refactor VyOS to use cliconf * Use show configuration commands on get_config * Remove debug statement * Construct command/answer/prompt if needed and fix commit comments * Convert command/prompt/answer to bytes
This commit is contained in:
parent
6732be3e62
commit
fec39ba1f2
2 changed files with 70 additions and 39 deletions
|
@ -52,18 +52,18 @@ class Cliconf(CliconfBase):
|
|||
return device_info
|
||||
|
||||
def get_config(self):
|
||||
return self.send_command(b'show configuration all')
|
||||
return self.send_command(b'show configuration commands')
|
||||
|
||||
def edit_config(self, command):
|
||||
for cmd in chain([b'configure'], to_list(command)):
|
||||
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)
|
||||
return self.send_command(to_bytes(command), prompt=to_bytes(prompt), answer=to_bytes(answer), sendonly=sendonly)
|
||||
|
||||
def commit(self, comment=None):
|
||||
if comment:
|
||||
command = b'commit comment {0}'.format(comment)
|
||||
command = b'commit comment "{0}"'.format(comment)
|
||||
else:
|
||||
command = b'commit'
|
||||
self.send_command(command)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue