Skip to content

Commit 4618fa3

Browse files
gmicollhercot
authored andcommitted
[ignore] Modify conditions to construct URL for aci_route_control_profile.
1 parent 1289c05 commit 4618fa3

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

plugins/modules/aci_route_control_profile.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -211,41 +211,35 @@ def main():
211211

212212
aci = ACIModule(module)
213213

214-
if l3out is not None:
215-
aci.construct_url(
216-
root_class=dict(
214+
tenant_url_config = dict(
217215
aci_class="fvTenant",
218216
aci_rn="tn-{0}".format(tenant),
219217
module_object=tenant,
220218
target_filter={"name": tenant},
221-
),
219+
)
220+
221+
route_control_profile_url_config = dict(
222+
aci_class="rtcrtlProfile",
223+
aci_rn="prof-{0}".format(route_control_profile),
224+
module_object=route_control_profile,
225+
target_filter={"name": route_control_profile},
226+
)
227+
228+
if l3out is not None:
229+
aci.construct_url(
230+
root_class=tenant_url_config,
222231
subclass_1=dict(
223232
aci_class="l3extOut",
224233
aci_rn="out-{0}".format(l3out),
225234
module_object=l3out,
226235
target_filter={"name": l3out},
227236
),
228-
subclass_2=dict(
229-
aci_class="rtcrtlProfile",
230-
aci_rn="prof-{0}".format(route_control_profile),
231-
module_object=route_control_profile,
232-
target_filter={"name": route_control_profile},
233-
),
237+
subclass_2=route_control_profile_url_config,
234238
)
235239
else:
236240
aci.construct_url(
237-
root_class=dict(
238-
aci_class="fvTenant",
239-
aci_rn="tn-{0}".format(tenant),
240-
module_object=tenant,
241-
target_filter={"name": tenant},
242-
),
243-
subclass_1=dict(
244-
aci_class="rtcrtlProfile",
245-
aci_rn="prof-{0}".format(route_control_profile),
246-
module_object=route_control_profile,
247-
target_filter={"name": route_control_profile},
248-
),
241+
root_class=tenant_url_config,
242+
subclass_1=route_control_profile_url_config,
249243
)
250244

251245
aci.get_existing()

0 commit comments

Comments
 (0)