Skip to content

Commit

Permalink
Merge branch 'rc2.0.45'
Browse files Browse the repository at this point in the history
  • Loading branch information
troydai committed Aug 22, 2018
2 parents b173317 + ba22152 commit 47a462f
Show file tree
Hide file tree
Showing 727 changed files with 435,912 additions and 13,238 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ exclude =
scripts
doc
build_scripts

*/grammar/
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
/src/command_modules/azure-cli-cloud/ @yugangw-msft
/src/command_modules/azure-cli-container/ @yolo3301
/src/command_modules/azure-cli-consumption/ @sandeepnl
/src/command_modules/azure-cli-dls/ @lewu-msft
/src/command_modules/azure-cli-eventgrid/ @kalyanaj
/src/command_modules/azure-cli-extension/ @williexu
/src/command_modules/azure-cli-keyvault/ @tjprescott
Expand Down
19 changes: 17 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,28 @@ jobs:
env: TOXENV=py27
script: ./scripts/ci/unittest.sh
- stage: verify
env: PURPOSE='Automation'
env:
- PURPOSE='Automation'
- REDUCE_SDK='True'
script: ./scripts/ci/test_automation.sh
python: 3.6
- stage: verify
env: PURPOSE='Automation'
script: ./scripts/ci/test_automation.sh
python: 2.7
- stage: verify
env:
- PURPOSE='Automation'
- REDUCE_SDK='True'
- AZURE_CLI_TEST_TARGET_PROFILE='2017-03-09'
script: ./scripts/ci/test_automation.sh
python: 3.6
- stage: verify
env:
- PURPOSE='Automation'
- AZURE_CLI_TEST_TARGET_PROFILE='2018-03-01'
script: ./scripts/ci/test_automation.sh
python: 2.7
- stage: verify
script: ./scripts/ci/test_static.sh
env: PURPOSE='Static Check'
Expand Down Expand Up @@ -85,4 +100,4 @@ stages:
- precheck
- unittest
- verify
- publish
- publish
33 changes: 29 additions & 4 deletions azure-cli2017.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<Compile Include="azure-cli-command_modules-nspkg\azure\cli\command_modules\__init__.py" />
<Compile Include="azure-cli-command_modules-nspkg\setup.py" />
<Compile Include="azure-cli-core\azure\cli\core\adal_authentication.py" />
<Compile Include="azure-cli-core\azure\cli\core\api.py" />
<Compile Include="azure-cli-core\azure\cli\core\azlogging.py" />
<Compile Include="azure-cli-core\azure\cli\core\cloud.py" />
<Compile Include="azure-cli-core\azure\cli\core\commands\arm.py" />
Expand All @@ -46,6 +47,7 @@
<Compile Include="azure-cli-core\azure\cli\core\extensions\__init__.py" />
<Compile Include="azure-cli-core\azure\cli\core\file_util.py" />
<Compile Include="azure-cli-core\azure\cli\core\keys.py" />
<Compile Include="azure-cli-core\azure\cli\core\mock.py" />
<Compile Include="azure-cli-core\azure\cli\core\parser.py" />
<Compile Include="azure-cli-core\azure\cli\core\profiles\_shared.py" />
<Compile Include="azure-cli-core\azure\cli\core\profiles\__init__.py" />
Expand All @@ -69,6 +71,7 @@
<Compile Include="azure-cli-core\azure\cli\core\tests\test_util.py" />
<Compile Include="azure-cli-core\azure\cli\core\tests\test_core_validators.py" />
<Compile Include="azure-cli-core\azure\cli\core\util.py" />
<Compile Include="azure-cli-core\azure\cli\core\_completers.py" />
<Compile Include="azure-cli-core\azure\cli\core\_config.py" />
<Compile Include="azure-cli-core\azure\cli\core\_debug.py" />
<Compile Include="azure-cli-core\azure\cli\core\_environment.py" />
Expand Down Expand Up @@ -238,6 +241,7 @@
<Compile Include="command_modules\azure-cli-cloud\setup.py" />
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\commands.py" />
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\custom.py" />
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\tests\latest\test_api_properties.py" />
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\tests\latest\test_cognitiveservices_command.py" />
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\_client_factory.py" />
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\_help.py" />
Expand Down Expand Up @@ -405,6 +409,14 @@
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\__init__.py" />
<Compile Include="command_modules\azure-cli-interactive\azure_bdist_wheel.py" />
<Compile Include="command_modules\azure-cli-interactive\setup.py" />
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\commands.py" />
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\custom.py" />
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\tests\latest\test_iotcentral_commands.py" />
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\_client_factory.py" />
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\_help.py" />
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\_params.py" />
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\__init__.py" />
<Compile Include="command_modules\azure-cli-iotcentral\setup.py" />
<Compile Include="command_modules\azure-cli-iot\azure\cli\command_modules\iot\custom.py" />
<Compile Include="command_modules\azure-cli-iot\azure\cli\command_modules\iot\commands.py" />
<Compile Include="command_modules\azure-cli-iot\azure\cli\command_modules\iot\mgmt_iot_hub_device\lib\credentials.py" />
Expand Down Expand Up @@ -480,6 +492,11 @@
<Compile Include="command_modules\azure-cli-maps\__init__.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\commands.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\actions.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertConditionLexer.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertConditionListener.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertConditionParser.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertConditionValidator.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\__init__.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\action_groups.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\activity_log.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\activity_log_alerts.py" />
Expand Down Expand Up @@ -507,7 +524,6 @@
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\_help.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\_params.py" />
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\__init__.py" />
<Compile Include="command_modules\azure-cli-monitor\azure_bdist_wheel.py" />
<Compile Include="command_modules\azure-cli-monitor\setup.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\test_dns_commands.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\test_network_commands.py" />
Expand Down Expand Up @@ -936,6 +952,13 @@
<Folder Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\tests\" />
<Folder Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\tests\latest\" />
<Folder Include="command_modules\azure-cli-interactive\docs\" />
<Folder Include="command_modules\azure-cli-iotcentral\" />
<Folder Include="command_modules\azure-cli-iotcentral\azure\" />
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\" />
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\" />
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\" />
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\tests\" />
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\tests\latest\" />
<Folder Include="command_modules\azure-cli-iot\" />
<Folder Include="command_modules\azure-cli-iot\azure\" />
<Folder Include="command_modules\azure-cli-iot\azure\cli\" />
Expand Down Expand Up @@ -984,6 +1007,7 @@
<Folder Include="command_modules\azure-cli-monitor\azure\cli\" />
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\" />
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\" />
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\" />
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\" />
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\tests\" />
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\tests\latest\" />
Expand Down Expand Up @@ -1228,6 +1252,7 @@
<Content Include="command_modules\azure-cli-interactive\README.md" />
<Content Include="command_modules\azure-cli-interactive\README.rst" />
<Content Include="command_modules\azure-cli-interactive\setup.cfg" />
<Content Include="command_modules\azure-cli-iotcentral\HISTORY.rst" />
<Content Include="command_modules\azure-cli-iot\azure\cli\command_modules\iot\mgmt_iot_hub_device\swagger_iot_hub_device_identity.json" />
<Content Include="command_modules\azure-cli-iot\HISTORY.rst" />
<Content Include="command_modules\azure-cli-keyvault\azure\cli\command_modules\keyvault\tests\latest\policy.json" />
Expand All @@ -1244,15 +1269,15 @@
<Content Include="command_modules\azure-cli-lab\README.rst" />
<Content Include="command_modules\azure-cli-lab\setup.cfg" />
<Content Include="command_modules\azure-cli-maps\HISTORY.rst" />
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertCondition.g4" />
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\build_python.bat" />
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\run_test.bat" />
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\autoscale-parameters-template.json" />
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\_autoscale_util.py">
<SubType>Code</SubType>
</Content>
<Content Include="command_modules\azure-cli-monitor\HISTORY.rst" />
<Content Include="command_modules\azure-cli-monitor\linter_exclusions.yml" />
<Content Include="command_modules\azure-cli-monitor\MANIFEST.in" />
<Content Include="command_modules\azure-cli-monitor\README.rst" />
<Content Include="command_modules\azure-cli-monitor\setup.cfg" />
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\zone_files\fail1.txt" />
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\zone_files\fail2.txt" />
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\zone_files\fail3.txt" />
Expand Down
50 changes: 50 additions & 0 deletions doc/authoring_command_modules/authoring_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ The document provides instructions and guidelines on how to author individual co

[15. Preventing particular extensions from being loading](#extension-suppression)

[16. Deprecating Commands and Arguments](#deprecating-commands-and-arguments)

Authoring Commands
=============================

Expand Down Expand Up @@ -754,3 +756,51 @@ class MyCommandsLoader(AzCommandsLoader):
reason='These commands are now in the CLI.',
recommend_remove=True))
```

## Deprecating Commands and Arguments

The CLI has built-in support for deprecating the following: commands, command groups, arguments, option values. Deprecated items will appear with a warning in the help system or when invoked. The following keyword arugments are supported when deprecating an item:

- `target`: The thing being deprecated. This is often not needed as in most cases the CLI can figure out what is being deprecated.
- `redirect`: This is the alternative that should be used in lieu of the deprecated thing. If not provided, the item is expected to be removed in the future with no replacement.
- `hide`: Hide the deprecated item from the help system, reducing discoverability, but still allow it to be used. Accepts either the boolean `True` to immediately hide the item or a core CLI version. If a version is supplied, the item will appear until the core CLI rolls to the specified value, after which it will be hidden.
- `expiration`: Accepts a core CLI version at which the deprecated item will no longer function. This version will be communicated in all warning messages.

Deprecation of different command elements are usually accomplished using the `deprecate_info` kwarg in conjunction with a `deprecate` helper method.

***Deprecate Command Group***
```Python
with self.command_group('test', test_sdk, deprecate_info=self.deprecate(redirect='new-test', hide=True)) as g:
g.show_command('show', 'get')
g.command('list', 'list')
```

This will deprecate the entire command group `test`. Note that call to `self.deprecate`, calling the deprecate helper method off of the command loader. The warning message for this would read: ```This command group has been deprecated and will be removed in a future release. Use `new-test` instead.```

Additionally, since the command group is deprecated then, by extension, all of the commands within it are deprecated as well. They will not be marked as such, but will display a warning:

```This command has been implicitly deprecated because command group `test` is deprecated and will be removed in a future release. Use `new-test` instead.```

***Deprecate Command***
```Python
with self.command_group('test', test_sdk) as g:
g.command('show-parameters', 'get_params', deprecate_info=g.deprecate(redirect='test show', expiration='2.1.0'))
```

This will deprecate the command `test show-parameters`. Note that call to `g.deprecate`, calling the deprecate helper method off of the command group. The warning message for this would read: ```This command has been deprecated and will be removed in version 2.1.0. Use `test show` instead.```

***Deprecate Argument***
```Python
with self.argument_context('test show-parameters') as c:
c.argument('junk_flag', help='Something we no longer want to support.' deprecate_info=c.deprecate(expiration='2.1.0'))
```

This will deprecate the argument `--junk-flag` on `test show-parameters`. Note that call to `c.deprecate`, calling the deprecate helper method off of the argument context. The warning message for this would read: ```Argument `--junk-flag` has been deprecated and will be removed in version 2.1.0.```

***Deprecate Argument Option***
```Python
with self.argument_context('test show-parameters') as c:
c.argument('resource', options_list=['--resource', c.deprecate(target='--resource-id', redirect='--target')])
```

This will deprecate the argument `--resource-id` option on `test show-parameters` in favor of `--resource`. Note that call to `c.deprecate`, calling the deprecate helper method off of the argument context. The warning message for this would read: ```Option `--resource-id` has been deprecated and will be removed in a future release. Use `--resource` instead.``` Here you must specify `target` in order to identify the deprecated option. When an option value is deprecated, it appears in help as two separate arguments, with the deprecation warning on the deprecated option.
1 change: 1 addition & 0 deletions doc/sphinx/azhelpgen/doc_source_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"batchai": "src/command_modules/azure-cli-batchai/azure/cli/command_modules/batchai/_help.py",
"backup": "src/command_modules/azure-cli-backup/azure/cli/command_modules/backup/_help.py",
"billing": "src/command_modules/azure-cli-billing/azure/cli/command_modules/billing/_help.py",
"botservice": "src/command_modules/azure-cli-botservice/azure/cli/command_modules/botservice/_help.py",
"cdn": "src/command_modules/azure-cli-cdn/azure/cli/command_modules/cdn/_help.py",
"cloud": "src/command_modules/azure-cli-cloud/azure/cli/command_modules/cloud/_help.py",
"consumption": "src/command_modules/azure-cli-consumption/azure/cli/command_modules/consumption/_help.py",
Expand Down
5 changes: 4 additions & 1 deletion scripts/ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ testsrc_dir=$(cd artifacts/testsrc && pwd)
script_dir=`cd $(dirname $0); pwd`

target_profile=${AZURE_CLI_TEST_TARGET_PROFILE:-latest}
if [ "$target_profile" != "latest" ]; then
if [ "$target_profile" = "2017-03-09" ]; then
# example: profile-2017-03-09. Python module name can't begin with a digit.
target_profile=profile_${target_profile//-/_}
elif [ "$target_profile" = "2018-03-01" ]
then
target_profile=hybrid_${target_profile//-/_}
fi
echo Pick up profile: $target_profile

Expand Down
16 changes: 15 additions & 1 deletion scripts/ci/test_automation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,24 @@ pip install -qqq $ALL_MODULES
title 'Installed packages'
pip freeze

if [ "$REDUCE_SDK" == "True" ]
then
title 'azure.mgmt file counts'
(cd $(dirname $(which python)); cd ../lib/*/site-packages/azure/mgmt; find . -name '*.py' | wc)

python $(cd $(dirname $0); cd ..; pwd)/sdk_process/patch_models.py

title 'azure.mgmt file counts after reduce'
(cd $(dirname $(which python)); cd ../lib/*/site-packages/azure/mgmt; find . -name '*.py' | wc)
fi

target_profile=${AZURE_CLI_TEST_TARGET_PROFILE:-latest}
if [ "$target_profile" != "latest" ]; then
if [ "$target_profile" = "2017-03-09" ]; then
# example: 2017-03-09-profile
target_profile=$target_profile-profile
elif [ "$target_profile" = "2018-03-01" ]
then
target_profile=$target_profile-hybrid
fi

title 'Running tests'
Expand Down
8 changes: 8 additions & 0 deletions scripts/move-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ for test_folder in `find src/command_modules -name tests`; do
cp -r $t/recordings/2017-03-09-profile/* $test_folder/profile_2017_03_09/recordings/
fi

if [ -d $t/recordings/2018-03-01-hybrid ]; then
mkdir -p $test_folder/hybrid_2018_03_01
cp -r $t/* $test_folder/hybrid_2018_03_01
rm -r $test_folder/hybrid_2018_03_01/recordings
mkdir -p $test_folder/hybrid_2018_03_01/recordings
cp -r $t/recordings/2018-03-01-hybrid/* $test_folder/hybrid_2018_03_01/recordings/
fi

mkdir -p $test_folder/latest
cp -r $t/* $test_folder/latest/

Expand Down
Loading

0 comments on commit 47a462f

Please sign in to comment.