diff --git a/changelogs/fragments/nxos_bugfixes.yaml b/changelogs/fragments/nxos_bugfixes.yaml index a90119630e1..888bc5e1492 100644 --- a/changelogs/fragments/nxos_bugfixes.yaml +++ b/changelogs/fragments/nxos_bugfixes.yaml @@ -32,3 +32,4 @@ bugfixes: - nxos_logging - remove purge from nxos_logging doc, argspec (https://github.com/ansible/ansible/pull/39947) - nxos_ping - Fix nxos_ping issues (https://github.com/ansible/ansible/pull/40028) - nxos_vxlan_vtep_vni - Fix nxos_vxlan_vtep_vni test (https://github.com/ansible/ansible/pull/39968) +- nxos_snapshot - Fix logic for save_snapshot_locally (https://github.com/ansible/ansible/pull/40227) diff --git a/lib/ansible/modules/network/nxos/nxos_snapshot.py b/lib/ansible/modules/network/nxos/nxos_snapshot.py index 93a172af17a..f095bc4e0e5 100644 --- a/lib/ansible/modules/network/nxos/nxos_snapshot.py +++ b/lib/ansible/modules/network/nxos/nxos_snapshot.py @@ -396,7 +396,7 @@ def main(): result['commands'] = action_results result['changed'] = True - if action == 'create' and module.params['path']: + if action == 'create' and module.params['path'] and module.params['save_snapshot_locally']: command = 'show snapshot | include {}'.format(module.params['snapshot_name']) content = execute_show_command(command, module)[0] if content: diff --git a/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml b/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml index 4f1e18f640c..5220d8d56e5 100644 --- a/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml @@ -13,6 +13,7 @@ action: create snapshot_name: test_snapshot1 description: Ansible + save_snapshot_locally: true provider: "{{ connection }}" - name: create another snapshot @@ -24,6 +25,7 @@ show_command: show ip interface brief row_id: ROW_intf element_key1: intf-name + save_snapshot_locally: true provider: "{{ connection }}" - name: compare snapshots