Skip to content

Commit 2a510f4

Browse files
authored
dcnm_inventory: Fix set_role issue (#487)
* Fix role set issue * Fix indentation problem * Fix Keys Not Found Errors
1 parent e8a931a commit 2a510f4

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

plugins/modules/dcnm_interface.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4263,8 +4263,17 @@ def dcnm_intf_compare_want_and_have(self, state):
42634263
nv_keys = list(want[k][0][ik].keys())
42644264
# List of keys to check and potentially remove from nv_keys
42654265
# Some keys are not present in the first GET and must be removed
4266-
keys_to_check = ["SPEED", "NATIVE_VLAN", "ENABLE_ORPHAN_PORT", "PORT_DUPLEX_MODE",
4267-
"DISABLE_LACP_SUSPEND", "ENABLE_LACP_VPC_CONV"]
4266+
keys_to_check = [
4267+
"CDP_ENABLE",
4268+
"DISABLE_LACP_SUSPEND",
4269+
"ENABLE_LACP_VPC_CONV",
4270+
"ENABLE_MONITOR",
4271+
"ENABLE_ORPHAN_PORT",
4272+
"ENABLE_PFC",
4273+
"NATIVE_VLAN",
4274+
"PORT_DUPLEX_MODE",
4275+
"SPEED"
4276+
]
42684277

42694278
for key in keys_to_check:
42704279
# Remove the key from nv_keys only if it exists and is not present in 'have'

plugins/modules/dcnm_inventory.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,10 +1493,12 @@ def assign_role(self):
14931493
method = "POST"
14941494
path = f"{self.nd_prefix}/rest/control/switches/roles"
14951495
data = json.dumps(
1496-
{
1497-
"serialNumber": role["serialNumber"],
1498-
"role": create["role"],
1499-
}
1496+
[
1497+
{
1498+
"serialNumber": role["serialNumber"],
1499+
"role": create["role"].replace("_", " "),
1500+
}
1501+
]
15001502
)
15011503
response = dcnm_send(self.module, method, path, data)
15021504
self.result["response"].append(response)
@@ -1528,10 +1530,12 @@ def assign_role(self):
15281530
method = "POST"
15291531
path = f"{self.nd_prefix}/rest/control/switches/roles"
15301532
data = json.dumps(
1531-
{
1532-
"serialNumber": role["serialNumber"],
1533-
"role": create["role"],
1534-
}
1533+
[
1534+
{
1535+
"serialNumber": role["serialNumber"],
1536+
"role": create["role"].replace("_", " "),
1537+
}
1538+
]
15351539
)
15361540
response = dcnm_send(self.module, method, path, data)
15371541
self.result["response"].append(response)

0 commit comments

Comments
 (0)