8000 [Carry #1136] Return real booleans in the output by michael-k · Pull Request #1409 · cloudtools/troposphere · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Carry #1136] Return real booleans in the output #1409

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

Merged
merged 4 commits into from
Jul 16, 2019

Conversation

michael-k
Copy link
Contributor
@michael-k michael-k commented May 29, 2019

This picks up the work done by @ikben in PR #1136, addresses the merge conflict by rebasing and fixes the failing tests.

@michael-k
Copy link
Contributor Author

Commit 62fbe39 should not have passed the tests. I've tried that before: https://travis-ci.com/michael-k/troposphere/builds/113547741
Maybe I've pushed the last commit to fast and travis got confused. ¯\_(ツ)_/¯

@benbridts
Copy link
Contributor

Feel free to squash all the commits together, there's nothing ground-breaking in mine :)

@markpeek
Copy link
Member

Waiting on review/approval from @phobologic

@phobologic
Copy link
Member

This looks good to me from a code perspective - but I'm curious what we should do to make sure folks aren't freaked out if suddenly a bunch of their stacks start updating?

The other question I have is whether or not json's booleans are actually case sensitive? This page makes me think they are:

https://json-schema.org/understanding-json-schema/reference/boolean.html

@michael-k
Copy link
Contributor Author
michael-k commented Jul 1, 2019

I'm curious what we should do to make sure folks aren't freaked out if suddenly a bunch of their stacks start updating?

If they are neither reading the changelog nor using cfn-lint … Maybe it's a good thing if they freak out and they'll start using cfn-lint afterwards.

The other question I have is whether or not json's booleans are actually case sensitive?

Yes, they are.

Python:

import json

json.loads("true")  # True
json.loads("True")  # JSONDecodeError

Javascript:

JSON.parse("true")  # true
JSON.parse("True")  # SyntaxError

@phobologic
Copy link
Member

Ahh, sorry - my bad on the case sensitive question, I had flipped the cases between the python/resulting templates in my head somehow. That looks good.

I waffle a little on punishing/scaring folks for not using cfn-lint. Maybe a better way to roll this out would be to have this be sort of "Feature Flagged" with an environment variable or something, and only turn it on if that variable is set - then start using warnings to let folks know that this change is coming. Then after a verison or two we can make it the default? What are you thoughts?

@michael-k
Copy link
Contributor Author

Any suggestions regarding the naming of such a env var?

@phobologic
Copy link
Member

I'm open to just about anything - OUTPUT_REAL_BOOLEANS maybe?

Also, don't take my suggestion as what has to happen :) Just wanted to get some conversation started around it. It seems like a nice compromise though, letting folks who want to use real booleans start using it while not penalizing folks who aren't ready for it.

Also curious around thoughts on throwing warnings to let folks know about the change so that we can encourage people to prepare. @markpeek @michael-k

@markpeek
Copy link
Member
markpeek commented Jul 8, 2019

Likely prefix for uniqueness: TROPO_REAL_BOOL? Is just an env var sufficient or do we need to add a function enablement as well? I do wonder if warnings are too invasive and we should communicate via release notes and the email list.

Redshift's `ParameterValue` is a string, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-property-redshift-clusterparametergroup-parameter.html

CloudFront StreamingDistribution's `Enabled` is a boolean, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html
and
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-trustedsigners.html

Amazon EMR's `Enable*Encryption` are booleans, see
https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-create-security-configuration.html#emr-encryption-intransit-cli

AWS DLM's `CopyTag` is a boolean, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html

OpsWorks' `MysqlRootPasswordUbiquitous` seems to be a string, see
https://github.com/awsdocs/aws-opsworks-user-guide/blob/master/doc_source/cli-examples-describe-layers.md

Elasticsearch's `rest.action.multi.allow_explicit_index` is a boolean,
see
https://www.elastic.co/guide/en/elasticsearch/reference/current/url-access-control.html

EC2 ClientVpnEndpoint's ConnectionLogOptions's `Enabled` is a boolean, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-connectionlogoptions.html#cfn-ec2-clientvpnendpoint-connectionlogoptions-enabled

MSK Cluster's EncryptionInTransit's `InCluster` is a boolean, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-msk-cluster-encryptionintransit.html#cfn-msk-cluster-encryptionintransit-incluster

Closes cloudtools#1136 and cloudtools#1409
@michael-k
Copy link
Contributor Author
michael-k commented Jul 10, 2019

I've added support for the env var TROPO_REAL_BOOL. As you can see in the commits tab,

  • tests are passing in commit 020cb83 (tests not adjusted; env var not set = booleans as strings) and
  • tests are also passing after adjusting the tests and setting the env var to "true" in commit 39c71b5.

Is this good enough or does this need tests for the old behavior as well?

@phobologic
Copy link
Member

This looks great to me. Thanks @michael-k for seeing this through!

@markpeek markpeek merged commit 4b5d44d into cloudtools:master Jul 16, 2019
@markpeek
Copy link
Member

Thank you @michael-k and @ikben!

8000

@michael-k michael-k deleted the real-booleans branch July 17, 2019 09:17
davemasino pushed a commit to davemasino/troposphere that referenced this pull request Oct 17, 2019
…s#1409)

* Use real booleans in the output only if env var is set
* Adjust booleans in tests and examples

Redshift's `ParameterValue` is a string, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-property-redshift-clusterparametergroup-parameter.html

CloudFront StreamingDistribution's `Enabled` is a boolean, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html
and
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-trustedsigners.html

Amazon EMR's `Enable*Encryption` are booleans, see
https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-create-security-configuration.html#emr-encryption-intransit-cli

AWS DLM's `CopyTag` is a boolean, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html

OpsWorks' `MysqlRootPasswordUbiquitous` seems to be a string, see
https://github.com/awsdocs/aws-opsworks-user-guide/blob/master/doc_source/cli-examples-describe-layers.md

Elasticsearch's `rest.action.multi.allow_explicit_index` is a boolean,
see
https://www.elastic.co/guide/en/elasticsearch/reference/current/url-access-control.html

EC2 ClientVpnEndpoint's ConnectionLogOptions's `Enabled` is a boolean, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-connectionlogoptions.html#cfn-ec2-clientvpnendpoint-connectionlogoptions-enabled

MSK Cluster's EncryptionInTransit's `InCluster` is a boolean, see
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-msk-cluster-encryptionintransit.html#cfn-msk-cluster-encryptionintransit-incluster

Closes cloudtools#1136 and cloudtools#1409
davemasino pushed a commit to davemasino/troposphere that referenced this pull request Oct 17, 2019
marinpurgar added a commit to marinpurgar/troposphere that referenced this pull request Mar 3, 2021
markpeek pushed a commit that referenced this pull request Mar 14, 2021
* Fix autoscaling.Tags to use boolean instead of str
- reference: #1409
* Use boolean() for propagation default value too
* Fix test_tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0