mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
MSO: Clean up internal references (#53242)
During the development of the new site modules the use of references is more common and this urged making the mechanism more simple overall.
This commit is contained in:
@@ -211,7 +211,7 @@ def main():
|
||||
if contract:
|
||||
contracts = [(c['contractRef'],
|
||||
c['relationshipType']) for c in schema_obj['templates'][template_idx]['anps'][anp_idx]['epgs'][epg_idx]['contractRelationships']]
|
||||
contract_ref = mso.contract_ref(contract)
|
||||
contract_ref = mso.contract_ref(**contract)
|
||||
if (contract_ref, contract['type']) in contracts:
|
||||
contract_idx = contracts.index((contract_ref, contract['type']))
|
||||
# FIXME: Changes based on index are DANGEROUS
|
||||
|
||||
@@ -234,7 +234,7 @@ def main():
|
||||
contract_idx = contracts.index(contract)
|
||||
|
||||
filters = [f['filterRef'] for f in schema_obj['templates'][template_idx]['contracts'][contract_idx][filter_key]]
|
||||
filter_ref = mso.filter_ref(filter_schema_id, filter_template, filter_name)
|
||||
filter_ref = mso.filter_ref(schema_id=filter_schema_id, template=filter_template, filter=filter_name)
|
||||
if filter_ref in filters:
|
||||
filter_idx = filters.index(filter_ref)
|
||||
# FIXME: Changes based on index are DANGEROUS
|
||||
@@ -289,13 +289,14 @@ def main():
|
||||
mso.existing = mso.sent
|
||||
|
||||
if contract_idx is None:
|
||||
# COntract does not exist, so we have to create it
|
||||
if contract_display_name is None:
|
||||
contract_display_name = contract
|
||||
if contract_filter_type is None:
|
||||
contract_ftype = 'bothWay'
|
||||
if contract_scope is None:
|
||||
contract_scope = 'context'
|
||||
if not mso.existing:
|
||||
# Contract does not exist, so we have to create it
|
||||
if contract_display_name is None:
|
||||
contract_display_name = contract
|
||||
if contract_filter_type is None:
|
||||
contract_ftype = 'bothWay'
|
||||
if contract_scope is None:
|
||||
contract_scope = 'context'
|
||||
|
||||
payload = {
|
||||
'name': contract,
|
||||
|
||||
Reference in New Issue
Block a user