Skip to content

Commit 0714014

Browse files
authored
Updated dcnm_vrf to honor deploy flag
1 parent b47dcf2 commit 0714014

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

plugins/modules/dcnm_vrf.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,14 +2069,15 @@ def get_diff_replace(self):
20692069
for vrf in all_vrfs:
20702070
# If the playbook sets the deploy key to False, then we need to remove the vrf from the deploy list.
20712071
want_vrf_data = find_dict_in_list_by_key_value(search=self.config, key="vrf_name", value=vrf)
2072-
if want_vrf_data['deploy'] is False:
2072+
if want_vrf_data.get('deploy',True) is False:
20732073
modified_all_vrfs.remove(vrf)
20742074

2075-
if not self.diff_deploy:
2076-
diff_deploy.update({"vrfNames": ",".join(modified_all_vrfs)})
2077-
else:
2078-
vrfs = self.diff_deploy["vrfNames"] + "," + ",".join(modified_all_vrfs)
2079-
diff_deploy.update({"vrfNames": vrfs})
2075+
if modified_all_vrfs:
2076+
if not diff_deploy:
2077+
diff_deploy.update({"vrfNames": ",".join(modified_all_vrfs)})
2078+
else:
2079+
vrfs = self.diff_deploy["vrfNames"] + "," + ",".join(modified_all_vrfs)
2080+
diff_deploy.update({"vrfNames": vrfs})
20802081

20812082
self.diff_attach = copy.deepcopy(diff_attach)
20822083
self.diff_deploy = copy.deepcopy(diff_deploy)
@@ -2380,11 +2381,15 @@ def diff_merge_attach(self, replace=False):
23802381
for vrf in all_vrfs:
23812382
# If the playbook sets the deploy key to False, then we need to remove the vrf from the deploy list.
23822383
want_vrf_data = find_dict_in_list_by_key_value(search=self.config, key="vrf_name", value=vrf)
2383-
if want_vrf_data['deploy'] is False:
2384+
if want_vrf_data.get("deploy", True) is False:
23842385
modified_all_vrfs.remove(vrf)
23852386

2386-
if len(modified_all_vrfs) != 0:
2387-
diff_deploy.update({"vrfNames": ",".join(all_vrfs)})
2387+
if modified_all_vrfs:
2388+
if not diff_deploy:
2389+
diff_deploy.update({"vrfNames": ",".join(modified_all_vrfs)})
2390+
else:
2391+
vrfs = self.diff_deploy["vrfNames"] + "," + ",".join(modified_all_vrfs)
2392+
diff_deploy.update({"vrfNames": vrfs})
23882393

23892394
self.diff_attach = diff_attach
23902395
self.diff_deploy = diff_deploy

0 commit comments

Comments
 (0)