Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloudstack: fix spelling of "affinity_type" #33231

Merged
merged 1 commit into from
Nov 28, 2017

Conversation

vincentbernat
Copy link
Contributor

SUMMARY

Fix spelling of affinity_type (not affinty_type).

However, to not break existing playbook, add an undocumented alias for
affinty_type.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

cloudstack

ANSIBLE VERSION

2.4.0.0

@ansibot
Copy link
Contributor

ansibot commented Nov 23, 2017

cc @resmo
click here for bot help

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request cloud cloudstack community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. test This PR relates to tests. labels Nov 23, 2017
@ansibot
Copy link
Contributor

ansibot commented Nov 23, 2017

The test ansible-test sanity --test validate-modules [?] failed with the following error:

lib/ansible/modules/cloud/cloudstack/cs_affinitygroup.py:0:0: E309 version_added for new option (affinity_type) should be 2.5. Currently 0.0

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Nov 23, 2017
@vincentbernat
Copy link
Contributor Author

Unsure about the best way to fix this E309 error.

Copy link
Contributor

@resmo resmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Salut @vincentbernat

It looks I screwed... with the argument name, didn't I? :)

I would suggest to deprecate the old argument and add some infos in the description. The old agument has to be kept for 4 releases according policy. That is why we can remove it in 2.9 (2.5-2.8).

Optionally, a pass a set of the two args as mutually_exclusive to AnsibleModule, to ensure only one could be used (see https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/basic.py#L774).

Thanks!

@@ -160,7 +160,7 @@ def get_affinity_group(self):
return self.affinity_group

def get_affinity_type(self):
affinity_type = self.module.params.get('affinty_type')
affinity_type = self.module.params.get('affinity_type')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-        affinity_type = self.module.params.get('affinty_type')
+        affinity_type = self.module.params.get('affinity_type') or self.module.params.get('affinty_type')

@@ -217,7 +217,7 @@ def main():
argument_spec = cs_argument_spec()
argument_spec.update(dict(
name=dict(required=True),
affinty_type=dict(),
affinity_type=dict(aliases=['affinty_type']),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets deprecate the "old" param:

-        affinty_type=dict(),
+        affinty_type=dict(removed_in_version='2.9'),
+        affinity_type=dict(),

@@ -36,7 +36,7 @@
description:
- Name of the affinity group.
required: true
affinty_type:
affinity_type:
description:
- Type of the affinity group. If not specified, first found affinity type is used.
required: false
Copy link
Contributor

@resmo resmo Nov 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the old value as an alias here:

...
        - Type of the affinity group. If not specified, first found affinity type is used. 
+       - The misspelled C(affinty_type) has been corrected in 2.5. For backwards compatibility it is used as an alias and will be removed in version 2.9.
    required: false
+   aliases: [ affinty_type ]

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Nov 25, 2017
The previous spelling, "affinty_type" is marked as deprecated and will
be removed in Ansible 2.9. Both spelling are mutually exclusives.
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Nov 27, 2017
@vincentbernat
Copy link
Contributor Author

I have updated the commit with the requested changes.

Copy link
Contributor

@resmo resmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shipit

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Nov 28, 2017
@resmo resmo merged commit e65001e into ansible:devel Nov 28, 2017
@resmo
Copy link
Contributor

resmo commented Nov 28, 2017

Thanks.

@ansibot ansibot added the bug This issue/PR relates to a bug. label Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. cloud cloudstack community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants