mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Refactor IOS libs to use cliconf (#34136)
* Refactor IOS libs to use cliconf * Fix pep8 * Remove bytstrings from edit_config and additional end on load_config * Fix pep8
This commit is contained in:
parent
2b3b689616
commit
477cd3f775
2 changed files with 70 additions and 39 deletions
|
@ -65,10 +65,21 @@ class Cliconf(CliconfBase):
|
|||
@enable_mode
|
||||
def edit_config(self, command):
|
||||
for cmd in chain(['configure terminal'], to_list(command), ['end']):
|
||||
self.send_command(to_bytes(cmd))
|
||||
try:
|
||||
cmd = json.loads(cmd)
|
||||
command = cmd['command']
|
||||
prompt = cmd['prompt']
|
||||
answer = cmd['answer']
|
||||
except:
|
||||
command = cmd
|
||||
prompt = None
|
||||
answer = None
|
||||
|
||||
self.send_command(to_bytes(command), to_bytes(prompt), to_bytes(answer))
|
||||
|
||||
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 get_capabilities(self):
|
||||
result = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue