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

Bugfix and assorted fixes (#28352)

These are updates from aci-ansible.
This commit is contained in:
Dag Wieers 2017-08-17 21:00:23 +02:00 committed by GitHub
parent d4cedbee20
commit e801187899
5 changed files with 22 additions and 21 deletions

View file

@ -138,7 +138,7 @@ class ACIModule(object):
# Handle deprecated method/action parameter
if self.params['method']:
# Deprecate only if state was a valid option (not for aci_rest)
if self.module.argument_spec('state', False):
if 'state' in self.module.argument_spec:
self.module.deprecate("Parameter 'method' or 'action' is deprecated, please use 'state' instead", '2.6')
method_map = dict(delete='absent', get='query', post='present')
self.params['state'] = method_map[self.params['method']]

View file

@ -18,10 +18,6 @@ description:
- Manage top level Application Profile (AP) objects on Cisco ACI fabrics
- More information from the internal APIC class
I(fv:Ap) at U(https://developer.cisco.com/media/mim-ref/MO-fvAp.html).
notes:
- This module does not manage EPGs, see M(aci_epg) to do this.
- The C(tenant) used must exist before using this module in your playbook.
The M(aci_tenant) module can be used for this.
author:
- Swetha Chunduri (@schunduri)
- Dag Wieers (@dagwieers)
@ -29,6 +25,10 @@ author:
version_added: '2.4'
requirements:
- ACI Fabric 1.0(3f)+
notes:
- This module does not manage EPGs, see M(aci_epg) to do this.
- The C(tenant) used must exist before using this module in your playbook.
The M(aci_tenant) module can be used for this.
options:
tenant:
description:

View file

@ -118,7 +118,7 @@ def main():
description = module.params['description']
scope = module.params['scope']
priority = module.params['priority']
target = module.params['target']
dscp = module.params['dscp']
state = module.params['state']
aci = ACIModule(module)
@ -143,7 +143,7 @@ def main():
if state == 'present':
# Filter out module parameters with null values
aci.payload(aci_class='vzBrCP', class_config=dict(name=contract, descr=description, scope=scope, prio=priority, targetDscp=target))
aci.payload(aci_class='vzBrCP', class_config=dict(name=contract, descr=description, scope=scope, prio=priority, targetDscp=dscp))
# Generate config diff which will be used as POST request body
aci.get_diff(aci_class='vzBrCP')

View file

@ -45,7 +45,7 @@ options:
subject:
description:
- The name of the Contract Subject.
aliases: [ subject_name ]
aliases: [ contract_subject, subject_name ]
state:
description:
- Use C(present) or C(absent) for adding or removing.
@ -85,9 +85,9 @@ def main():
argument_spec = aci_argument_spec
argument_spec.update(
contract=dict(type='str', aliases=['contract_name']),
filter_name=dict(type='str'),
filter=dict(type='str', aliases=['filter_name']),
log=dict(tyep='str', choices=['log', 'none'], aliases=['directive']),
subject=dict(type='str', aliases=['subject_name']),
subject=dict(type='str', aliases=['contract_subject', 'subject_name']),
tenant=dict(type='str', aliases=['tenant_name']),
state=dict(type='str', default='present', choices=['absent', 'present', 'query']),
method=dict(type='str', choices=['delete', 'get', 'post'], aliases=['action'], removed_in_version='2.6'), # Deprecated starting from v2.6
@ -96,12 +96,12 @@ def main():
module = AnsibleModule(
argument_spec=argument_spec,
supports_check_mode=True,
required_if=[['state', 'absent', ['contract', 'filter_name', 'subject', 'tenant']],
['state', 'present', ['contract', 'filter_name', 'subject', 'tenant']]]
required_if=[['state', 'absent', ['contract', 'filter', 'subject', 'tenant']],
['state', 'present', ['contract', 'filter', 'subject', 'tenant']]]
)
# contract = module.params['contract']
filter_name = module.params['filter_name']
filter_name = module.params['filter']
log = module.params['log']
# subject = module.params['subject']
# tenant = module.params['tenant']
@ -114,7 +114,7 @@ def main():
# TODO: cleanup this logic and provide better filter_strings for all options
if filter_name is not None:
# Work with specific binding
path = 'api/mo/uni/tn-%(tenant)s/brc-%(contract)s/subj-%(subject)s/rssubjFiltAtt-%(filter_name)s.json' % module.params
path = 'api/mo/uni/tn-%(tenant)s/brc-%(contract)s/subj-%(subject)s/rssubjFiltAtt-%(filter)s.json' % module.params
else:
path = 'api/class/vzRsSubjFiltAtt.json'

View file

@ -52,14 +52,15 @@ options:
entry:
description:
- Then name of the Filter Entry.
aliases: [ entry_name, name ]
aliases: [ entry_name, filter_entry, name ]
ether_type:
description:
- The Ethernet type.
choices: [ arp, fcoe, ip, mac_security, mpls_ucast, trill, unspecified ]
filter_name:
filter:
description:
The name of Filter that the entry should belong to.
aliases: [ filter_name ]
icmp_msg_type:
description:
- ICMPv4 message type; used when ip_protocol is icmp.
@ -94,7 +95,7 @@ EXAMPLES = r'''
tenant: "{{ tenant }}"
ether_name: "{{ ether_name }}"
icmp_msg_type: "{{ icmp_msg_type }}"
filter_name: "{{ filter_name }}"
filter: "{{ filter }}"
descr: "{{ descr }}"
host: "{{ inventory_hostname }}"
username: "{{ user }}"
@ -132,9 +133,9 @@ def main():
dst_port=dict(type='str'),
dst_port_end=dict(type='str'),
dst_port_start=dict(type='str'),
entry=dict(type='str', aliases=['entry_name', 'name']),
entry=dict(type='str', aliases=['entry_name', 'filter_entry', 'name']),
ether_type=dict(choices=VALID_ETHER_TYPES, type='str'),
filter_name=dict(type='str'),
filter=dict(type='str', aliases=['filter_name']),
icmp_msg_type=dict(type='str', choices=VALID_ICMP_TYPES),
icmp6_msg_type=dict(type='str', choices=VALID_ICMP6_TYPES),
ip_protocol=dict(choices=VALID_IP_PROTOCOLS, type='str'),
@ -163,7 +164,7 @@ def main():
dst_start = FILTER_PORT_MAPPING[dst_start]
entry = module.params['entry']
ether_type = module.params['ether_type']
filter_name = module.params['filter_name']
filter_name = module.params['filter']
icmp_msg_type = module.params['icmp_msg_type']
if icmp_msg_type is not None:
icmp_msg_type = ICMP_MAPPING[icmp_msg_type]
@ -192,7 +193,7 @@ def main():
if entry is not None:
# fail when entry is provided without tenant and filter_name
if tenant is not None and filter_name is not None:
path = 'api/mo/uni/tn-%(tenant)s/flt-%(filter_name)s/e-%(entry)s.json' % module.params
path = 'api/mo/uni/tn-%(tenant)s/flt-%(filter)s/e-%(entry)s.json' % module.params
elif tenant is not None and state == 'query':
path = 'api/mo/uni/tn-%(tenant)s.json?rsp-subtree=full&rsp-subtree-class=vzEntry&rsp-subtree-filter=eq(vzEntry.name, \
\"%(entry)s\")&rsp-subtree-include=no-scoped' % module.params