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

improve double validation and fix some property datatypes #1179

Merged

Conversation

robertaistleitner
Copy link
Contributor

fixes #812 + improves validator consistency with AWS naming

  • replace floatingpoint validator with more valid double validator - this is also the naming used in AWS CloudFormation
  • update CloudWatch Alarm Threshold datatype to double (according to documentation)
  • update Glue ExecutionProperty MaxConcurrentRuns datatype to positive_integer (according to documentation)

 - replace `floatingpoint` validator with more valid `double` validator - this is also the naming used in AWS CloudFormation
 - update CloudWatch Alarm Threshold datatype to double (according to [documentation](https://docs.aws.amazon.com/de_de/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-threshold))
 - update Glue ExecutionProperty MaxConcurrentRuns datatype to positive_integer (according to [documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-job-executionproperty.html#cfn-glue-job-executionproperty-maxconcurrentruns))
@@ -53,11 +53,11 @@ def integer_list_item_checker(x):
return integer_list_item_checker


def floatingpoint(x):
def double(x):
Copy link
Member

Choose a reason for hiding this comment

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

Rather than replacing it entirely, maybe we should keep a copy of floatingpoint around for backwards compatibility. Two things we could do:

  1. Just do the update here, then set floatingpoint to be floatingpoint = double here as well.
  2. Have floatingpoint call double, but include a warning that floatingpoint will be deprecated soon.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we expect floatingpoint to be used outside of this package? In this case I will change it of course, although if this is not the case I'd rather clean it up right away since nothing like a floatingpoint is found throughout the AWS CloudFormation documentation, right?

Ad 1. This would show a wrong error message stating that a floatingpoint is expected.
Ad 2. See first paragraph, if there's external references to it this would probably be the best solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for sending the comment multiple times - blame Github for it 😉

Copy link
Member

Choose a reason for hiding this comment

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

Good point - it's unlikely it's being used in custom resources, so this is probably fine. One last thing: can you please merge master into this branch, and just make sure there are no remaining cases? We've had a few merges, and some may have used floatingpoint.

Thanks - I'll accept/merge this as soon as you have a chance to merge master!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done ✔️

@phobologic
Copy link
Member

Thanks @robertaistleitner !

@phobologic phobologic merged commit b7b5c78 into cloudtools:master Oct 29, 2018
davemasino pushed a commit to davemasino/troposphere that referenced this pull request Oct 17, 2019
…#1179)

* improve double validation and fix some property datatypes

 - replace `floatingpoint` validator with more valid `double` validator - this is also the naming used in AWS CloudFormation
 - update CloudWatch Alarm Threshold datatype to double (according to [documentation](https://docs.aws.amazon.com/de_de/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-threshold))
 - update Glue ExecutionProperty MaxConcurrentRuns datatype to positive_integer (according to [documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-job-executionproperty.html#cfn-glue-job-executionproperty-maxconcurrentruns))

* please the linter

* adopt use of floatingpoint to double due to merge of master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloudwatch Alarms support a parameter in the Threshold property, yet troposphere requires a basestring
2 participants