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

[aws] Add suboptions to aws_application_scaling_policy #43042

Merged
merged 2 commits into from Sep 5, 2018

Conversation

ryansb
Copy link
Contributor

@ryansb ryansb commented Jul 19, 2018

SUMMARY

For target policy, options filled in by jinja2 were loaded as strings and not converted to integers before being passed to the scaling policy API. This change adds suboptions to enforce int types on API params requiring integers.

Fixes #42917

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

aws_application_scaling_policy

ANSIBLE VERSION

ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Jul 19, 2018

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 aws bug This issue/PR relates to a bug. cloud 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. labels Jul 19, 2018
@samdoran samdoran removed the needs_triage Needs a first human triage before being processed. label Jul 19, 2018
target_tracking_scaling_policy_configuration=dict(
required=False,
type='dict',
options=dict(
Copy link
Contributor

Choose a reason for hiding this comment

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

This fixes problem for me but could maybe use checking that these options are not None now that the argspec may set unwanted defaults.

The full traceback is:
Traceback (most recent call last):
  File "/var/folders/by/k8_fbl593dlctgqmwq5wzl2c0000gn/T/ansible_XpZlS8/ansible_module_aws_application_scaling_policy.py", line 423, in create_scaling_policy
    TargetTrackingScalingPolicyConfiguration=scaling_policy['TargetTrackingScalingPolicyConfiguration']
  File "/Users/shertel/Workspace/ansible/venv/python2.7.13/lib/python2.7/site-packages/botocore/client.py", line 314, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/shertel/Workspace/ansible/venv/python2.7.13/lib/python2.7/site-packages/botocore/client.py", line 586, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/Users/shertel/Workspace/ansible/venv/python2.7.13/lib/python2.7/site-packages/botocore/client.py", line 621, in _convert_to_request_dict
    api_params, operation_model)
  File "/Users/shertel/Workspace/ansible/venv/python2.7.13/lib/python2.7/site-packages/botocore/validate.py", line 291, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
ParamValidationError: Parameter validation failed:
Invalid type for parameter TargetTrackingScalingPolicyConfiguration.CustomizedMetricSpecification, value: None, type: <type 'NoneType'>, valid types: <type 'dict'>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I'll take another crack at this.

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jul 28, 2018
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 4, 2018
@ryansb ryansb merged commit 9d1bf32 into ansible:devel Sep 5, 2018
ryansb added a commit to ryansb/ansible that referenced this pull request Sep 5, 2018
* [aws] Add suboptions to aws_application_scaling_policy

Fixes ansible#42917

* Remove any suboptions that are None

(cherry picked from commit 9d1bf32)
abadger pushed a commit that referenced this pull request Sep 6, 2018
* [aws] Add suboptions to aws_application_scaling_policy

Fixes #42917

* Remove any suboptions that are None

(cherry picked from commit 9d1bf32)
@ryansb ryansb deleted the aws-scaling-policy-int-suboptions branch September 6, 2018 18:45
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 aws bug This issue/PR relates to a bug. cloud 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ansible won't convert string to int
4 participants