We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When you set entire s3 bucket lifesycle, you get setting like follows:
$ aws s3api get-bucket-lifecycle --bucket my-bucket-name { "Rules": [ { "Status": "Enabled", "Prefix": null, "Transition": { "Days": 1, "StorageClass": "GLACIER" }, "Expiration": { "Days": 5 }, "ID": "Rule for the Entire Bucket" } ] }
note that "Prefix": null, when I put this back lifesycle setting with this json, Prefix is set to string None.
"Prefix": null,
None
$ aws s3api put-bucket-lifecycle --bucket my-bucket-name --lifecycle file://lifecycle.json $ aws s3api get-bucket-lifecycle --bucket my-bucket-name { "Rules": [ { "Status": "Enabled", "Prefix": "None", "Transition": { "Days": 1, "StorageClass": "GLACIER" }, "Expiration": { "Days": 5 }, "ID": "Rule for the Entire Bucket" } ] }
Simple fix is adding None condition check when converting to xml. If this approach is fine, I'll add a test case for that and pull request it.
$ git diff . diff --git a/botocore/parameters.py b/botocore/parameters.py index 8ad9cbd..4d78fe5 100644 --- a/botocore/parameters.py +++ b/botocore/parameters.py @@ -123,8 +123,10 @@ class Parameter(BotoCoreObject): def to_xml(self, value, label=None): if not label: label = self.name - return '<%s>%s</%s>' % (label, value, label) - + if value is None: + return '<%s></%s>' % (label, label) + else: + return '<%s>%s</%s>' % (label, value, label) class IntegerParameter(Parameter):
The text was updated successfully, but these errors were encountered:
I think this is a reasonable approach, feel free to send a PR with tests to the botocore repo.
You should be able to add the test in tests/unit/test_s3_operations.py
tests/unit/test_s3_operations.py
Thanks!
Sorry, something went wrong.
Thank for your feedback. The code change is in botocore library, so I pull-requested to boto/botocore.
boto/botocore#229
boto/botocore#229 has now been merged. Thanks for the pull request.
Update changelog with #637
bb8b570
No branches or pull requests
When you set entire s3 bucket lifesycle, you get setting like follows:
note that
"Prefix": null,
when I put this back lifesycle setting with this json, Prefix is set to string
None
.Simple fix is adding None condition check when converting to xml.
If this approach is fine, I'll add a test case for that and pull request it.
The text was updated successfully, but these errors were encountered: