ACI AEP: Update module to use new URL Method (#28619)

* ACI AEP: Update module to use new URL Method

* ACI AEP: Update module to use new URL Method

* ACI AEP: Update module to use new URL Method
pull/27817/head
Jacob McGill 7 years ago committed by Dag Wieers
parent ddd3e6fb91
commit 061fe51e9a

@ -97,6 +97,10 @@ def main():
module = AnsibleModule(
argument_spec=argument_spec,
supports_check_mode=True,
required_if=[
['state', 'absent', ['aep']],
['state', 'present', ['aep']],
],
)
aep = module.params['aep']
@ -104,21 +108,18 @@ def main():
state = module.params['state']
aci = ACIModule(module)
if aep is not None:
path = 'api/mo/uni/infra/attentp-%(aep)s.json' % module.params
elif state == 'query':
path = 'api/class/infraAttEntityP.json'
else:
module.fail_json(msg="Parameter 'aep' is required for state 'absent' or 'present'")
aci.result['url'] = '%(protocol)s://%(hostname)s/' % aci.params + path
aci.construct_url(root_class="aep")
aci.get_existing()
if state == 'present':
# Filter out module parameters with null values
aci.payload(aci_class='infraAttEntityP', class_config=dict(name=aep, descr=description))
aci.payload(
aci_class='infraAttEntityP',
class_config=dict(
name=aep,
descr=description,
),
)
# Generate config diff which will be used as POST request body
aci.get_diff(aci_class='infraAttEntityP')

Loading…
Cancel
Save