mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
* adds commit replace with config file for iosxr (#35564)
* * adds commit replace with config file for iosxr * fixes dci failure in iosxr_logging * * review comment changes
This commit is contained in:
parent
2479b6d635
commit
684e953b50
11 changed files with 227 additions and 48 deletions
|
@ -67,12 +67,27 @@ class Cliconf(CliconfBase):
|
|||
|
||||
return self.send_command(cmd)
|
||||
|
||||
def edit_config(self, command):
|
||||
for cmd in chain(to_list(command)):
|
||||
self.send_command(cmd)
|
||||
def edit_config(self, commands=None):
|
||||
for cmd in chain(to_list(commands)):
|
||||
try:
|
||||
if isinstance(cmd, str):
|
||||
cmd = json.loads(cmd)
|
||||
command = cmd.get('command', None)
|
||||
prompt = cmd.get('prompt', None)
|
||||
answer = cmd.get('answer', None)
|
||||
sendonly = cmd.get('sendonly', False)
|
||||
newline = cmd.get('newline', True)
|
||||
except:
|
||||
command = cmd
|
||||
prompt = None
|
||||
answer = None
|
||||
sendonly = None
|
||||
newline = None
|
||||
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
|
||||
self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, newline=newline)
|
||||
|
||||
def get(self, command=None, prompt=None, answer=None, sendonly=False, newline=True):
|
||||
return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, newline=newline)
|
||||
|
||||
def commit(self, comment=None):
|
||||
if comment:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue