Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
581cb60
[Breadth Coverage] Onboard Import Export (#1515)
arrownj Apr 22, 2020
54e0ed2
[Monitor]App byos and link la (#1499)
mmyyrroonn Apr 22, 2020
850f6aa
[Release] Update index.json for extension [ application-insights ] (#…
Apr 22, 2020
56a867c
[Release] Update index.json for extension [ support ] (#1569)
Apr 22, 2020
e99c137
[Release] Update index.json for extension [ import-export ] (#1574)
Apr 23, 2020
5b84f75
[HanaOnAzure] Updated HanaOnAzure CLI extension to include SapMonitor…
PakDLiu Apr 23, 2020
8877ae4
[Import Export] add __init__.py for generated package (#1582)
arrownj Apr 23, 2020
81d264d
[Release] Update index.json for extension [ import-export ] (#1583)
Apr 23, 2020
3d97c71
downgrade the version since the service is not ready (#1580)
mmyyrroonn Apr 23, 2020
3360eca
[Breadth Coverage] Datashare (#1476)
fengzhou-msft Apr 23, 2020
73dfe9e
[Release] Update index.json for extension [ datashare ] (#1586)
Apr 23, 2020
5cfc900
[Breadth Coverage] Portal (#1428)
Apr 23, 2020
85c8cbf
Change portal README file from rst to markdown (#1589)
Apr 23, 2020
4c707a0
[Breadth Coverage] logic apps (#1423)
bquantump Apr 24, 2020
5e3d07c
[Release] Update index.json for extension [ image-copy ] (#1568)
Apr 24, 2020
69c7333
Fix a small error in commands.py and update test sample file (#1595)
Apr 25, 2020
12e0bd9
[Release] Update index.json for extension [ portal ] (#1599)
Apr 25, 2020
246ec8e
[Release] Update index.json for extension [ logic ] (#1594)
Apr 25, 2020
f40506c
Fixed bug when hyperV version variable is None (#1553)
swbae31 Apr 26, 2020
285a0b5
[Release] Update index.json for extension [ vm-repair ] (#1601)
Apr 27, 2020
d597d8e
[Portal] Add portal generated module init file (#1609)
Apr 27, 2020
9528c6a
[Release] Update index.json for extension [ portal ] (#1610)
Apr 27, 2020
35b244f
{Monitor} refactor the logic (#1596)
mmyyrroonn Apr 27, 2020
3ede273
Update azure-cli-ml version to 1.4.0 (#1615)
j-so Apr 27, 2020
2fc19bd
[Release] Update index.json for extension [ application-insights ] (#…
Apr 28, 2020
14799ae
[Breadth Coverage] Log Analytics Solution (#1545)
zhoxing-ms Apr 29, 2020
e6c21fd
[Release] Update index.json for extension [ log-analytics-solution ] …
Apr 29, 2020
6827793
[Breadth Coverage] Time Series Insights (#1539)
jiasli Apr 29, 2020
71449ed
[Release] Update index.json for extension [ timeseriesinsights ] (#1623)
Apr 29, 2020
0f9aa58
Revert "spring-cloud: add support to enable/disable MSI (#1523)" (#1622)
leonard520 Apr 30, 2020
51f8b5d
[CI] Add wheel preinstallation for job IndexRefDocVerify and fix azur…
Apr 30, 2020
1ce82b0
[CI] Remove wheel usage (#1628)
Apr 30, 2020
13404e3
[storage-ors-preview] Support ORS policy for storage account (#1461)
Juliehzl May 1, 2020
d6aad6c
Adding updated Kusto extension (#1605)
astauben May 1, 2020
78df589
[Release] Update index.json for extension [ kusto ] (#1633)
May 1, 2020
2d844dd
[AKS] fix incorrect usage of ARM without going through the multi-api …
marwanad May 4, 2020
f178285
cli extension for connected kubernetes RP (#1570)
akashkeshari May 5, 2020
1884169
[Release] Update index.json for extension [ aks-preview ] (#1637)
May 5, 2020
2fb2d14
[Release] Update index.json for extension [ storage-ors-preview ] (#1…
May 6, 2020
1eb927c
[AKS] Unblock agentpool min count range check (#1606)
marwanad May 6, 2020
880774b
Fix the persicope version to always point to latest tag. (#1630)
Tatsinnit May 6, 2020
0b1ac90
[IoT] CLI extension release v0.9.2 (#1542)
digimaun May 6, 2020
14ec628
[storage-ors-preview] fix no azext metadata (#1648)
May 6, 2020
5926f06
[Release] Update index.json for extension [ storage-ors-preview ] (#1…
May 6, 2020
3fa9b10
added telemetry code for connect cli
May 6, 2020
5cbe47c
update help context (#1634)
zqingqing1 May 7, 2020
e489082
WIP {KubernetesConfiguration} Add extension CLI (#1550)
NarayanThiru May 7, 2020
9d60981
[storage-or-policy] rename the extension (#1662)
Juliehzl May 8, 2020
fca378c
{CI} temporary disable CredScan since ADO bug (#1666)
May 8, 2020
3d46998
[Release] Update index.json for extension [ storage-or-preview ] (#1665)
May 8, 2020
cf586cc
spring cloud - custom domain - cli (#1419)
1openwindow May 8, 2020
b0872b7
[Release] Update index.json for extension [ spring-cloud ] (#1669)
May 8, 2020
9f022a0
[Release] Update index.json for extension [ k8sconfiguration ] (#1659)
May 8, 2020
df2ecf4
[Release] Update index.json for extension [ connectedk8s ] (#1644)
May 8, 2020
f928d72
Fix extension name in readme (#1672)
ilidemi May 8, 2020
bffd137
[Breadth Coverage] Onboard Custom Providers Commands (#1627)
jsntcy May 9, 2020
5db8ce5
[Release] Update index.json for extension [ custom-providers ] (#1674)
May 9, 2020
01d4407
[TimeSeriesInsights] Fix timeSeriesIdPropertyName is not parsed prope…
jiasli May 9, 2020
5cf8340
[Release] Update index.json for extension [ timeseriesinsights ] (#1676)
May 11, 2020
94df344
update azure-cli-ml version to 1.2.0 (#1682)
j-so May 12, 2020
5c56299
Added exception telemetry for delete operation
May 12, 2020
4ddea41
Updated fork master with latest master
May 12, 2020
47fc01b
Updated with latest master
May 12, 2020
9239f83
Updated setup.py
May 12, 2020
ccdbff0
Changed default kubernetes distro
May 12, 2020
e6333d7
Distro detect.
pasankav May 12, 2020
1ef6cdd
Updated history
May 13, 2020
c1612c2
removed arm resourceid from telemetry
May 13, 2020
db1f4bd
Kubernetes connect cli telemetry integration (#1684)
akashkeshari May 13, 2020
5ed8f5d
bump vmware to 0.6.0 (#1656)
cataggar May 13, 2020
9943139
download from az-csvmware-cli (#1681)
cataggar May 13, 2020
feb1883
[Release] Update index.json for extension [ connectedk8s ] (#1689)
May 14, 2020
fb40791
AKS: add aks-custom-headers for nodepool and update (#1686)
andyzhangx May 14, 2020
3ed99da
Merge branch 'akash/connect_telemetry' into pavan/distro_detect
pasankav May 14, 2020
8a92c0c
[Release] Update index.json for extension [ aks-preview ] (#1699)
May 14, 2020
8b26810
Add kubernetes distro and identifying it.
pasankav May 14, 2020
df6806d
K8s configuration update min cli core version (#1697)
NarayanThiru May 14, 2020
87cbfa1
Add "Did You Mean This" Extension (#1692)
christopher-o-toole May 15, 2020
6bb06a7
[Release] Update index.json for extension [ k8sconfiguration ] (#1700)
May 15, 2020
fdacc2b
Remove additional line.
pasankav May 15, 2020
3860c00
correct indentation.
pasankav May 15, 2020
b9b4915
Merge branch 'master' into pavan/distro_detect
pasankav May 15, 2020
f8c4e04
correct indentation.
pasankav May 15, 2020
b752e92
correct version number.
pasankav May 15, 2020
9404057
Merge pull request #5 from akashkeshari/pavan/distro_detect
akashkeshari May 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,30 @@

/src/blueprint/ @fengzhou-msft

/src/storage-or-preview/ @Juliehzl

/src/logic/ @bquantump

/src/databox/ @jsntcy

/src/hpc-cache/ @qianwens

/src/timeseriesinsights/ @jiasli

/src/portal/ @YalinLi0312

/src/import-export/ @arrownj

/src/account/ @zikalino

/src/datashare/ @fengzhou-msft

/src/k8sconfiguration/ @NarayanThiru

/src/log-analytics-solution/ @zhoxing-ms

/src/kusto/ @ilayr @orhasban @astauben

/src/ai-did-you-mean-this/ @christopher-o-toole

/src/custom-providers/ @jsntcy
154 changes: 154 additions & 0 deletions azure-cli-extensions.pyproj

Large diffs are not rendered by default.

40 changes: 21 additions & 19 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ pr:
- '*'

jobs:
- job: CredScan
displayName: "Credential Scan"
pool:
vmImage: "windows-2019"
steps:
- task: ms-codeanalysis.vss-microsoft-security-code-analysis.build-task-credscan.CredScan@2
displayName: 'CredScan'
inputs:
toolVersion: 'Latest'
suppressionsFile: './scripts/ci/credscan/CredScanSuppressions.json'
- task: ms-codeanalysis.vss-microsoft-security-code-analysis.build-task-postanalysis.PostAnalysis@1
displayName: 'Post Analysis'
inputs:
AllTools: false
BinSkim: false
CredScan: true
RoslynAnalyzers: false
TSLint: false
ToolLogsNotFoundAction: 'Standard'
# - job: CredScan
# displayName: "Credential Scan"
# pool:
# vmImage: "windows-2019"
# steps:
# - task: ms-codeanalysis.vss-microsoft-security-code-analysis.build-task-credscan.CredScan@2
# displayName: 'CredScan'
# inputs:
# toolVersion: 'Latest'
# suppressionsFile: './scripts/ci/credscan/CredScanSuppressions.json'
# - task: ms-codeanalysis.vss-microsoft-security-code-analysis.build-task-postanalysis.PostAnalysis@1
# displayName: 'Post Analysis'
# inputs:
# AllTools: false
# BinSkim: false
# CredScan: true
# RoslynAnalyzers: false
# TSLint: false
# ToolLogsNotFoundAction: 'Standard'

- job: CheckLicenseHeader
displayName: "Check License"
Expand Down Expand Up @@ -162,6 +162,8 @@ jobs:
displayName: 'Use Python 3.7'
inputs:
versionSpec: 3.7
- bash: pip install wheel==0.30.0
displayName: 'Install wheel==0.30.0'
- task: Bash@3
displayName: "Verify Extension Ref Docs"
inputs:
Expand Down
9 changes: 8 additions & 1 deletion scripts/ci/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@
# --------------------------------------------------------------------------------------------

import os
import re
import json
import zipfile
from wheel.install import WHEEL_INFO_RE

# Dependencies that will not be checked.
# This is for packages starting with 'azure-' but do not use the 'azure' namespace.
SKIP_DEP_CHECK = ['azure-batch-extensions']

# copy from wheel==0.30.0
WHEEL_INFO_RE = re.compile(
r"""^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
\.whl|\.dist-info)$""",
re.VERBOSE).match


def get_repo_root():
current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down
10 changes: 10 additions & 0 deletions src/ai-did-you-mean-this/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Initial release.
* Add autogenerated recommendations for recovery from UserFault failures.
* Ensure that the hook is activated in common UserFault failure scenarios.
91 changes: 91 additions & 0 deletions src/ai-did-you-mean-this/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Microsoft Azure CLI 'AI Did You Mean This' Extension #

### Installation ###
To install the extension, use the below CLI command
```
az extension add --name ai-did-you-mean-this
```

### Background ###
The purpose of this extension is help users recover from failure. Once installed, failure recovery recommendations will automatically be provided for supported command failures. In cases where no recommendations are available, a prompt to use `az find` will be shown provided that the command can be matched to a valid CLI command.
### Limitations ###
For now, recommendations are limited to parser failures (i.e. not in a command group, argument required, unrecognized parameter, expected one argument, etc). Support for more core failures is planned for a future release.
### Try it out! ###
The following examples demonstrate how to trigger the extension. For a more complete list of supported CLI failure types, see this [CLI PR](https://github.com/Azure/azure-cli/pull/12889). Keep in mind that the recommendations shown here may be different from the ones that you receive.

#### az account ####
```
> az account
az account: error: the following arguments are required: _subcommand
usage: az account [-h]
{list,set,show,clear,list-locations,get-access-token,lock,management-group}
...

Here are the most common ways users succeeded after [account] failed:
az account list
az account show
```

#### az account set ####
```
> az account set
az account set: error: the following arguments are required: --subscription/-s
usage: az account set [-h] [--verbose] [--debug] [--only-show-errors]
[--output {json,jsonc,yaml,yamlc,table,tsv,none}]
[--query JMESPATH] --subscription SUBSCRIPTION

Here are the most common ways users succeeded after [account set] failed:
az account set --subscription Subscription
```

#### az group create ####
```
>az group create
az group create: error: the following arguments are required: --name/--resource-group/-n/-g, --location/-l
usage: az group create [-h] [--verbose] [--debug] [--only-show-errors]
[--output {json,jsonc,yaml,yamlc,table,tsv,none}]
[--query JMESPATH] [--subscription _SUBSCRIPTION]
--name RG_NAME --location LOCATION
[--tags [TAGS [TAGS ...]]] [--managed-by MANAGED_BY]

Here are the most common ways users succeeded after [group create] failed:
az group create --location westeurope --resource-group MyResourceGroup
```
#### az vm list ###
```
> az vm list --query ".id"
az vm list: error: argument --query: invalid jmespath_type value: '.id'
usage: az vm list [-h] [--verbose] [--debug] [--only-show-errors]
[--output {json,jsonc,yaml,yamlc,table,tsv,none}]
[--query JMESPATH] [--subscription _SUBSCRIPTION]
[--resource-group RESOURCE_GROUP_NAME] [--show-details]

Sorry I am not able to help with [vm list]
Try running [az find "az vm list"] to see examples of [vm list] from other users.
```
### Developer Build ###
If you want to try an experimental release of the extension, it is recommended you do so in a [Docker container](https://www.docker.com/resources/what-container). Keep in mind that you'll need to install Docker and pull the desired [Azure CLI image](https://hub.docker.com/_/microsoft-azure-cli) from the Microsoft Container Registry before proceeding.

#### Setting up your Docker Image ####
To run the Azure CLI Docker image as an interactive shell, run the below command by replacing `<version>` with your desired CLI version
```bash
docker run -it mcr.microsoft.com/azure-cli:<version>
export EXT="ai-did-you-mean-this"
pip install --upgrade --target ~/.azure/cliextensions/$EXT "git+https://github.com/christopher-o-toole/azure-cli-extensions.git@thoth-extension#subdirectory=src/$EXT&egg=$EXT"
```
Each time you start a new shell, you'll need to login before you can start using the extension. To do so, run
```bash
az login
```
and follow the instructions given in the prompt. Once you're logged in, try out the extension by issuing a faulty command
```
> az account
az account: error: the following arguments are required: _subcommand
usage: az account [-h]
{list,set,show,clear,list-locations,get-access-token,lock,management-group}
...

Here are the most common ways users succeeded after [account] failed:
az account list
az account show
```
52 changes: 52 additions & 0 deletions src/ai-did-you-mean-this/azext_ai_did_you_mean_this/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader

from knack.events import (
EVENT_INVOKER_CMD_TBL_LOADED
)

from azext_ai_did_you_mean_this._help import helps # pylint: disable=unused-import
from azext_ai_did_you_mean_this._cmd_table import on_command_table_loaded


def inject_functions_into_core():
from azure.cli.core.parser import AzCliCommandParser
from azext_ai_did_you_mean_this.custom import recommend_recovery_options
AzCliCommandParser.recommendation_provider = recommend_recovery_options


# pylint: disable=too-few-public-methods
class GlobalConfig():
ENABLE_STYLING = False


class AiDidYouMeanThisCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType

ai_did_you_mean_this_custom = CliCommandType(
operations_tmpl='azext_ai_did_you_mean_this.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=ai_did_you_mean_this_custom)
self.cli_ctx.register_event(EVENT_INVOKER_CMD_TBL_LOADED, on_command_table_loaded)
inject_functions_into_core()
# per https://github.com/Azure/azure-cli/pull/12601
try:
GlobalConfig.ENABLE_STYLING = cli_ctx.enable_color
except AttributeError:
pass

def load_command_table(self, args):
from azext_ai_did_you_mean_this.commands import load_command_table
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
pass


COMMAND_LOADER_CLS = AiDidYouMeanThisCommandsLoader
13 changes: 13 additions & 0 deletions src/ai-did-you-mean-this/azext_ai_did_you_mean_this/_cmd_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------


class CommandTable(): # pylint: disable=too-few-public-methods
CMD_TBL = None


def on_command_table_loaded(_, **kwargs):
cmd_tbl = kwargs.pop('cmd_tbl', None)
CommandTable.CMD_TBL = cmd_tbl
34 changes: 34 additions & 0 deletions src/ai-did-you-mean-this/azext_ai_did_you_mean_this/_const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

UPDATE_RECOMMENDATION_STR = (
"Better failure recovery recommendations are available from the latest version of the CLI. "
"Please update for the best experience.\n"
)

UNABLE_TO_HELP_FMT_STR = (
'\nSorry I am not able to help with [{command}]'
'\nTry running [az find "az {command}"] to see examples of [{command}] from other users.'
)

RECOMMENDATION_HEADER_FMT_STR = (
'\nHere are the most common ways users succeeded after [{command}] failed:'
)

TELEMETRY_MUST_BE_ENABLED_STR = (
'User must agree to telemetry before failure recovery recommendations can be presented.'
)

TELEMETRY_MISSING_SUBSCRIPTION_ID_STR = (
"Subscription ID was not set in telemetry."
)

TELEMETRY_MISSING_CORRELATION_ID_STR = (
"Correlation ID was not set in telemetry."
)

UNABLE_TO_CALL_SERVICE_STR = (
'Either the subscription ID or correlation ID was not set. Aborting operation.'
)
17 changes: 17 additions & 0 deletions src/ai-did-you-mean-this/azext_ai_did_you_mean_this/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from knack.help_files import helps # pylint: disable=unused-import

helps['ai-did-you-mean-this'] = """
type: group
short-summary: Add recommendations for recovering from failure.
"""

helps['ai-did-you-mean-this version'] = """
type: command
short-summary: Prints the extension version.
"""
28 changes: 28 additions & 0 deletions src/ai-did-you-mean-this/azext_ai_did_you_mean_this/_style.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import sys

from azext_ai_did_you_mean_this import GlobalConfig


def style_message(msg):
if should_enable_styling():
import colorama # pylint: disable=import-error

try:
msg = colorama.Style.BRIGHT + msg + colorama.Style.RESET_ALL
except KeyError:
pass
return msg


def should_enable_styling():
try:
if GlobalConfig.ENABLE_STYLING and sys.stdout.isatty():
return True
except AttributeError:
pass
return False
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.4.0"
}
12 changes: 12 additions & 0 deletions src/ai-did-you-mean-this/azext_ai_did_you_mean_this/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long


def load_command_table(self, _):

with self.command_group('ai-did-you-mean-this', is_preview=True) as g:
g.custom_command('version', 'show_extension_version')
Loading