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

{Core} Build and use command index #13294

Merged
merged 18 commits into from
Jun 29, 2020
Prev Previous commit
Next Next commit
invalidate_command_index when switching profiles
jiasli committed Jun 8, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 587825a89e002b75ac85dba7521ad29777fac504
6 changes: 4 additions & 2 deletions src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
@@ -712,8 +712,10 @@ def get_default_cli():
def invalidate_command_index():
"""Invalidate the command index.
This function must be called when installing, updating or removing extensions. Otherwise, if an extension overrides
a built-in command, the command will be loaded according to the stale command index.
This function must be called when installing, updating extensions. Otherwise, if an extension overrides
a built-in command, the command will be loaded from the command module as per the stale command index.
This function can be called when removing extensions and updating cloud profiles for double insurance.
"""
from azure.cli.core._session import INDEX
INDEX[_COMMAND_INDEX] = {}
2 changes: 2 additions & 0 deletions src/azure-cli-core/azure/cli/core/cloud.py
Original file line number Diff line number Diff line change
@@ -537,6 +537,8 @@ def update_cloud(cli_ctx, cloud):
if not _get_cloud(cli_ctx, cloud.name):
raise CloudNotRegisteredException(cloud.name)
_save_cloud(cloud, overwrite=True)
from azure.cli.core import invalidate_command_index
invalidate_command_index()


def remove_cloud(cli_ctx, cloud_name):