Skip to content

Commit d882504

Browse files
sajaganalhercot
authored andcommitted
[ignore] Changed the absent condition in aci_fabric_node_decommission module
1 parent b5f2822 commit d882504

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

plugins/modules/aci_fabric_node_decommission.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def main():
237237
),
238238
subclass_1=dict(
239239
aci_class="fabricRsDecommissionNode",
240-
aci_rn="rsdecommissionNode-[topology/pod-{0}/node-{1}]".format(pod_id, node_id),
240+
aci_rn="rsdecommissionNode-[{0}]".format(target_dn) if target_dn else None,
241241
target_filter={"tDn": target_dn},
242242
),
243243
)
@@ -255,7 +255,7 @@ def main():
255255
aci.get_diff(aci_class="fabricRsDecommissionNode")
256256
aci.post_config()
257257

258-
elif state == "absent": # Commission
258+
elif state == "absent" and aci.existing: # Commission
259259
# The aci.delete_config function removes the object directly from APIC, which can interrupt the commission or decommission process before it finishes.
260260
# Because of that the Fabric Node may enter a bad state.
261261
aci.payload(
@@ -265,10 +265,8 @@ def main():
265265
status="deleted",
266266
),
267267
)
268-
269-
if aci.existing:
270-
aci.get_diff(aci_class="fabricRsDecommissionNode")
271-
aci.post_config()
268+
aci.get_diff(aci_class="fabricRsDecommissionNode")
269+
aci.post_config()
272270

273271
aci.exit_json()
274272

0 commit comments

Comments
 (0)