mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
fix nxos_snapshot issues (#41034)
* fix nxos_snapshot issues * review comments * doc change
This commit is contained in:
parent
2db6a8c26a
commit
6733bffd5d
2 changed files with 89 additions and 26 deletions
|
@ -289,12 +289,6 @@ def invoke(name, *args, **kwargs):
|
|||
return func(*args, **kwargs)
|
||||
|
||||
|
||||
def get_snapshot(module):
|
||||
command = 'show snapshot dump {0}'.format(module.params['snapshot_name'])
|
||||
body = execute_show_command(command, module)[0]
|
||||
return body
|
||||
|
||||
|
||||
def write_on_file(content, filename, module):
|
||||
path = module.params['path']
|
||||
if path[-1] != '/':
|
||||
|
@ -373,10 +367,10 @@ def main():
|
|||
result['changed'] = True
|
||||
|
||||
if action == 'create' and module.params['path'] and module.params['save_snapshot_locally']:
|
||||
command = 'show snapshot | include {}'.format(module.params['snapshot_name'])
|
||||
command = 'show snapshot dump {} | json'.format(module.params['snapshot_name'])
|
||||
content = execute_show_command(command, module)[0]
|
||||
if content:
|
||||
write_on_file(content, module.params['snapshot_name'], module)
|
||||
write_on_file(str(content), module.params['snapshot_name'], module)
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue