aci_switch_leaf_selector: Support empty policy_group

This commit is contained in:
Dag Wieers 2018-11-02 17:07:50 +01:00 committed by Toshio Kuratomi
parent b0b9b4f7dd
commit ac2c1a89a8
2 changed files with 27 additions and 19 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- aci_switch_leaf_selector - Support empty policy_group

View file

@ -283,12 +283,7 @@ def main():
aci.get_existing()
if state == 'present':
aci.payload(
aci_class='infraLeafS',
class_config=dict(
descr=description,
name=leaf,
),
# Build child_configs dynamically
child_configs = [
dict(
infraNodeBlk=dict(
@ -300,14 +295,25 @@ def main():
),
),
),
dict(
]
# Add infraRsAccNodePGrp only when policy_group was defined
if policy_group is not None:
child_configs.append(dict(
infraRsAccNodePGrp=dict(
attributes=dict(
tDn='uni/infra/funcprof/accnodepgrp-{0}'.format(policy_group),
),
),
))
aci.payload(
aci_class='infraLeafS',
class_config=dict(
descr=description,
name=leaf,
),
],
child_configs=child_configs,
)
aci.get_diff(aci_class='infraLeafS')