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

Ignore command names on NoSuchCommand exceptions #8261

Merged
merged 1 commit into from
Apr 13, 2021

Conversation

ulyssessouza
Copy link
Collaborator

@ulyssessouza ulyssessouza commented Apr 7, 2021

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
@ulyssessouza ulyssessouza force-pushed the metrics-nosuchcommand branch from 2053472 to e5cab3c Compare April 7, 2021 23:20
Copy link
Contributor

@gtardif gtardif left a comment

Choose a reason for hiding this comment

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

Please add some test case to metrics_test.py for this bug.

@@ -36,7 +36,7 @@ def __init__(self, command,
context_type=None, status=Status.SUCCESS,
source=MetricsSource.CLI, uri=None):
super().__init__()
self.command = "compose " + command if command else "compose --help"
self.command = ("compose " + command).strip() if command else "compose --help"
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose this is to leave self.command = "compose" value in case of NoSuchCommand exception (when command = "") ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. In the case of NoSuchCommand the variable will have an empty string leaving a trailing space on the final string. The strip() is to remove it in this case.

@aiordache aiordache merged commit adae403 into docker:master Apr 13, 2021
@aiordache aiordache added this to the 1.29.1 milestone Apr 13, 2021
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