Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion plugins/modules/aci_config_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ def main():
target_filter={"name": export_policy},
),
)

# Variable set for reuse of correct url in get_existing() triggered from exit_json() after query request
reset_url = aci.url
aci.get_existing()

aci.payload(
Expand All @@ -293,6 +294,15 @@ def main():
# Create a new Snapshot
aci.post_config()

# Query for job information and add to results
# Change state to query else aci.request() will not execute a GET request but POST
aci.params["state"] = "query"
aci.request(path="/api/node/mo/uni/backupst/jobs-[uni/fabric/configexp-{0}].json".format(export_policy))
aci.result["job_details"] = aci.imdata[0].get("configJobCont", {})
# Reset state and url to display correct in output and trigger get_existing() function with correct url
aci.url = reset_url
aci.params["state"] = "present"

else:
# Prefix the proper url to export_policy
if export_policy is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use_proxy: '{{ aci_use_proxy | default(true) }}'
output_level: debug
export_policy: anstest
max_count: 10
include_secure: no
format: json
description: ansible test
Expand All @@ -27,6 +26,7 @@
- name: update snapshot to include secure and use xml - update works
cisco.aci.aci_config_snapshot:
<<: *create_snapshot
max_count: 10
include_secure: yes
format: xml
register: create_update
Expand Down Expand Up @@ -61,6 +61,9 @@
- invalid_max_count.msg == "Parameter 'max_count' must be a number between 1 and 10"
- missing_param is failed
- 'missing_param.msg == "state is present but all of the following are missing: export_policy"'
- create.job_details.attributes.dn == "uni/backupst/jobs-[uni/fabric/configexp-anstest]"
- create.job_details.attributes.name == "anstest"
- "'lastJobName' in create.job_details.attributes"

- name: query with export_policy
cisco.aci.aci_config_snapshot: &query_snapshot
Expand Down