mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
Refactor iosxr_config to make use of network_connection plugin
This commit is contained in:
parent
0eb4813c8a
commit
a8cfe4a5d7
5 changed files with 257 additions and 49 deletions
|
@ -55,7 +55,7 @@ def run_commands(module, commands, check_rc=True):
|
|||
responses.append(out)
|
||||
return responses
|
||||
|
||||
def load_config(module, commands, commit=False, replace=False):
|
||||
def load_config(module, commands, commit=False, replace=False, comment=None):
|
||||
assert isinstance(commands, list), 'commands must be a list'
|
||||
|
||||
rc, out, err = module.exec_command('configure terminal')
|
||||
|
@ -79,8 +79,11 @@ def load_config(module, commands, commit=False, replace=False):
|
|||
rc, diff, err = module.exec_command('show commit changes diff')
|
||||
if commit:
|
||||
cmd = 'commit'
|
||||
if comment:
|
||||
cmd += ' comment {0}'.format(comment)
|
||||
else:
|
||||
cmd = 'abort'
|
||||
diff = None
|
||||
module.exec_command(cmd)
|
||||
|
||||
return {'diff': diff}
|
||||
return diff
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue