1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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
This commit is contained in:
Jacob McGill 2017-08-24 20:46:09 -04:00 committed by Dag Wieers
parent ddd3e6fb91
commit 061fe51e9a

View file

@ -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')