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

Using split instead of regex for simple key=value type tags. #1968

Merged
merged 4 commits into from
May 7, 2020

Conversation

c2tarun
Copy link
Contributor

@c2tarun c2tarun commented May 6, 2020

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:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@c2tarun c2tarun requested a review from sriram-mv May 6, 2020 21:19
@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.
Copy link
Contributor

Choose a reason for hiding this comment

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

aws cli, not cfn.

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@sriram-mv sriram-mv self-requested a review May 6, 2020 22:19
@c2tarun c2tarun merged commit 660af96 into aws:develop May 7, 2020
@piersf
Copy link

piersf commented May 7, 2020

In which release will be this fix available?

@c2tarun
Copy link
Contributor Author

c2tarun commented May 7, 2020

@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.

@piersf
Copy link

piersf commented May 7, 2020

  • @c2tarun Thank you! I look forward to the next release.

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.

3 participants