cloudstack: fix spelling of "affinity_type" (#33231)

The previous spelling, "affinty_type" is marked as deprecated and will
be removed in Ansible 2.9. Both spelling are mutually exclusives.
pull/33333/head
Vincent Bernat 7 years ago committed by René Moser
parent 819f9ee8fa
commit e65001ee22

@ -36,11 +36,12 @@ options:
description: description:
- Name of the affinity group. - Name of the affinity group.
required: true required: true
affinty_type: affinity_type:
description: description:
- Type of the affinity group. If not specified, first found affinity type is used. - Type of the affinity group. If not specified, first found affinity type is used.
required: false required: false
default: null default: null
aliases: [ affinty_type ]
description: description:
description: description:
- Description of the affinity group. - Description of the affinity group.
@ -80,7 +81,7 @@ EXAMPLES = '''
- local_action: - local_action:
module: cs_affinitygroup module: cs_affinitygroup
name: haproxy name: haproxy
affinty_type: host anti-affinity affinity_type: host anti-affinity
# Remove a affinity group # Remove a affinity group
- local_action: - local_action:
@ -160,7 +161,7 @@ class AnsibleCloudStackAffinityGroup(AnsibleCloudStack):
return self.affinity_group return self.affinity_group
def get_affinity_type(self): def get_affinity_type(self):
affinity_type = self.module.params.get('affinty_type') affinity_type = self.module.params.get('affinity_type') or self.module.params.get('affinty_type')
affinity_types = self.query_api('listAffinityGroupTypes', ) affinity_types = self.query_api('listAffinityGroupTypes', )
if affinity_types: if affinity_types:
@ -217,7 +218,8 @@ def main():
argument_spec = cs_argument_spec() argument_spec = cs_argument_spec()
argument_spec.update(dict( argument_spec.update(dict(
name=dict(required=True), name=dict(required=True),
affinty_type=dict(), affinty_type=dict(removed_in_version='2.9'),
affinity_type=dict(),
description=dict(), description=dict(),
state=dict(choices=['present', 'absent'], default='present'), state=dict(choices=['present', 'absent'], default='present'),
domain=dict(), domain=dict(),
@ -229,6 +231,9 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=argument_spec, argument_spec=argument_spec,
required_together=cs_required_together(), required_together=cs_required_together(),
mutually_exclusive=(
['affinity_type', 'affinty_type'],
),
supports_check_mode=True supports_check_mode=True
) )

@ -22,7 +22,7 @@
- name: test fail unknown affinity type - name: test fail unknown affinity type
cs_affinitygroup: cs_affinitygroup:
name: "{{ cs_resource_prefix }}_ag" name: "{{ cs_resource_prefix }}_ag"
affinty_type: unexistent affinity type affinity_type: unexistent affinity type
register: ag register: ag
ignore_errors: true ignore_errors: true
- name: verify test fail unknown affinity type - name: verify test fail unknown affinity type

Loading…
Cancel
Save