Reorganize code
This commit is contained in:
parent
ac2c1a89a8
commit
7de09a4652
1 changed files with 24 additions and 24 deletions
|
@ -260,6 +260,30 @@ def main():
|
||||||
policy_group = module.params['policy_group']
|
policy_group = module.params['policy_group']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
|
||||||
|
# Build child_configs dynamically
|
||||||
|
child_configs = [
|
||||||
|
dict(
|
||||||
|
infraNodeBlk=dict(
|
||||||
|
attributes=dict(
|
||||||
|
descr=leaf_node_blk_description,
|
||||||
|
name=leaf_node_blk,
|
||||||
|
from_=from_,
|
||||||
|
to_=to_,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
# 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 = ACIModule(module)
|
aci = ACIModule(module)
|
||||||
aci.construct_url(
|
aci.construct_url(
|
||||||
root_class=dict(
|
root_class=dict(
|
||||||
|
@ -283,30 +307,6 @@ def main():
|
||||||
aci.get_existing()
|
aci.get_existing()
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
# Build child_configs dynamically
|
|
||||||
child_configs = [
|
|
||||||
dict(
|
|
||||||
infraNodeBlk=dict(
|
|
||||||
attributes=dict(
|
|
||||||
descr=leaf_node_blk_description,
|
|
||||||
name=leaf_node_blk,
|
|
||||||
from_=from_,
|
|
||||||
to_=to_,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
# 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.payload(
|
||||||
aci_class='infraLeafS',
|
aci_class='infraLeafS',
|
||||||
class_config=dict(
|
class_config=dict(
|
||||||
|
|
Loading…
Reference in a new issue