-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Using split instead of regex for simple key=value type tags. #1968
Conversation
samcli/cli/types.py
Outdated
@staticmethod | ||
def _standard_key_value_parser(tag_value): | ||
""" | ||
Method to parse simple `Key=Value` type tags without using regex. This is similar to how CFN does this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws cli, not cfn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahhhh.. missed it. Will fix now.
# assign to result['KeyName1'] = string and so on. | ||
result[_unquote_wrapped_quotes(key)] = _unquote_wrapped_quotes(v) | ||
# Using standard parser first. We should implement other type parser like JSON and Key=key,Value=val type format. | ||
parsed, k, v = self._standard_key_value_parser(val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we check for more than 1 count, given that aws cli already does it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws-cli simply pick first =
. I think our existing solution already handles more edge cases than aws-cli, we should keep using it until we implement separate parses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, but this solution only looks for one key value pair right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, we get list of key=value
tags. We parse each one. They are already separated by command and handled by click.
In which release will be this fix available? |
@piersf Code is merged, we haven't finalized exact date yet, but there are few more minor fixes we want to include as well. You can expect this release by early next week. |
|
Issue #, if available:
Issue #1960 and #1845
Why is this change necessary?
This change will unblock lot of users who use long tag value to upgrade from 0.41.0.
How does it address the issue?
For simple
key=value
type values we are not splitting on=
instead of using regex.What side effects does this change have?
None
Did you change a dependency in
requirements/base.txt
?If so, did you run
make update-reproducible-reqs
Checklist:
make pr
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.