Skip to content

{Core} Skip positional arguments for failure recommendations#15570

Merged
houk-ms merged 1 commit intoAzure:devfrom
houk-ms:fix-failure-recommendation
Oct 21, 2020
Merged

{Core} Skip positional arguments for failure recommendations#15570
houk-ms merged 1 commit intoAzure:devfrom
houk-ms:fix-failure-recommendation

Conversation

@houk-ms
Copy link
Contributor

@houk-ms houk-ms commented Oct 19, 2020

Description

Fix issue #15465#15591

This PR fixes the positional arguments parsing issue in failure recommendations. The original logic ignored the positional arguments, which would make CLI crash when running a command with positional arguments if that command failed.

Testing Guide

Previously, CLI will crash when running az acr build

...
azure/cli/core/command_recommender.py, ln 162, in recommend_a_command
    normalized_parameters = self._normalize_parameters(parameters)
azure/cli/core/command_recommender.py, ln 244, in _normalize_parameters
    standard_form = sorted_options[0]
IndexError: list index out of range

Now, it prints the right error messages

RequiredArgumentMissingError: the following arguments are required: --registry/-r, <SOURCE_LOCATION>
Try this: 'az acr build -r MyRegistry .'
Still stuck? Run 'az acr build --help' to view all commands or go to 'https://docs.microsoft.com/en-us/cli/azure/reference-index?view=azure-cli-latest' to learn more

@houk-ms
Copy link
Contributor Author

houk-ms commented Oct 19, 2020

@christopher-o-toole The original logic in failure recommendation seems to not consider the positional arguments. Do you have any plans to use them in Aladdin Service?

@houk-ms houk-ms mentioned this pull request Oct 21, 2020
@houk-ms houk-ms merged commit 5410c12 into Azure:dev Oct 21, 2020
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.

3 participants