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

[Interactive] Fix #16931: Fix KeyError in az interactive --update #17389

Merged
merged 2 commits into from
Mar 29, 2021

Conversation

fengzhou-msft
Copy link
Member

@fengzhou-msft fengzhou-msft commented Mar 22, 2021

Description

Resolve #16931

interactive is written in a special way that it is an azure-cli module, but it will install the interative extension for starting an interactive shell. With the use of command index, interactive command group only loads the interactive module and not azext_interactive module as the extension has 0 command. That's why reload_module will throw KeyError when trying to reload azext_interactive after updated.

This PR adds check whether the module is already imported before reloading it.

Testing Guide

  1. Install an old version of interactive
    az extension add --upgrade -n interactive --version 0.4.3
  2. Run the command to update interactive
    az interactive --update

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

@fengzhou-msft fengzhou-msft requested a review from msyyc as a code owner March 22, 2021 09:40
@fengzhou-msft fengzhou-msft requested a review from jiasli March 22, 2021 09:41
Comment on lines 488 to 491
try:
return reload_module(extension_module if extension_module else get_extension_modname(ext_name=extension_name))
except KeyError:
pass
Copy link
Member

Choose a reason for hiding this comment

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

How about we put the try except clause in

reload_extension(INTERACTIVE_EXTENSION_NAME)

az interactive should be responsible for non-existing extension, such as ExtensionNotInstalledException.

@fengzhou-msft fengzhou-msft changed the title [Interactive] Fix #16931: Ignore KeyError for reload_extension [Interactive] Fix #16931: Fix KeyError in az interactive --update Mar 23, 2021
@fengzhou-msft fengzhou-msft merged commit 44e1af8 into Azure:dev Mar 29, 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.

az interactive not working after update to latest az cli
2 participants