Skip to content

Commit 47a462f

Browse files
committed
Merge branch 'rc2.0.45'
2 parents b173317 + ba22152 commit 47a462f

File tree

727 files changed

+435912
-13238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

727 files changed

+435912
-13238
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ exclude =
1414
scripts
1515
doc
1616
build_scripts
17-
17+
*/grammar/

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/src/command_modules/azure-cli-cloud/ @yugangw-msft
1818
/src/command_modules/azure-cli-container/ @yolo3301
1919
/src/command_modules/azure-cli-consumption/ @sandeepnl
20+
/src/command_modules/azure-cli-dls/ @lewu-msft
2021
/src/command_modules/azure-cli-eventgrid/ @kalyanaj
2122
/src/command_modules/azure-cli-extension/ @williexu
2223
/src/command_modules/azure-cli-keyvault/ @tjprescott

.travis.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,28 @@ jobs:
4040
env: TOXENV=py27
4141
script: ./scripts/ci/unittest.sh
4242
- stage: verify
43-
env: PURPOSE='Automation'
43+
env:
44+
- PURPOSE='Automation'
45+
- REDUCE_SDK='True'
4446
script: ./scripts/ci/test_automation.sh
4547
python: 3.6
4648
- stage: verify
4749
env: PURPOSE='Automation'
4850
script: ./scripts/ci/test_automation.sh
4951
python: 2.7
52+
- stage: verify
53+
env:
54+
- PURPOSE='Automation'
55+
- REDUCE_SDK='True'
56+
- AZURE_CLI_TEST_TARGET_PROFILE='2017-03-09'
57+
script: ./scripts/ci/test_automation.sh
58+
python: 3.6
59+
- stage: verify
60+
env:
61+
- PURPOSE='Automation'
62+
- AZURE_CLI_TEST_TARGET_PROFILE='2018-03-01'
63+
script: ./scripts/ci/test_automation.sh
64+
python: 2.7
5065
- stage: verify
5166
script: ./scripts/ci/test_static.sh
5267
env: PURPOSE='Static Check'
@@ -85,4 +100,4 @@ stages:
85100
- precheck
86101
- unittest
87102
- verify
88-
- publish
103+
- publish

azure-cli2017.pyproj

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<Compile Include="azure-cli-command_modules-nspkg\azure\cli\command_modules\__init__.py" />
2727
<Compile Include="azure-cli-command_modules-nspkg\setup.py" />
2828
<Compile Include="azure-cli-core\azure\cli\core\adal_authentication.py" />
29+
<Compile Include="azure-cli-core\azure\cli\core\api.py" />
2930
<Compile Include="azure-cli-core\azure\cli\core\azlogging.py" />
3031
<Compile Include="azure-cli-core\azure\cli\core\cloud.py" />
3132
<Compile Include="azure-cli-core\azure\cli\core\commands\arm.py" />
@@ -46,6 +47,7 @@
4647
<Compile Include="azure-cli-core\azure\cli\core\extensions\__init__.py" />
4748
<Compile Include="azure-cli-core\azure\cli\core\file_util.py" />
4849
<Compile Include="azure-cli-core\azure\cli\core\keys.py" />
50+
<Compile Include="azure-cli-core\azure\cli\core\mock.py" />
4951
<Compile Include="azure-cli-core\azure\cli\core\parser.py" />
5052
<Compile Include="azure-cli-core\azure\cli\core\profiles\_shared.py" />
5153
<Compile Include="azure-cli-core\azure\cli\core\profiles\__init__.py" />
@@ -69,6 +71,7 @@
6971
<Compile Include="azure-cli-core\azure\cli\core\tests\test_util.py" />
7072
<Compile Include="azure-cli-core\azure\cli\core\tests\test_core_validators.py" />
7173
<Compile Include="azure-cli-core\azure\cli\core\util.py" />
74+
<Compile Include="azure-cli-core\azure\cli\core\_completers.py" />
7275
<Compile Include="azure-cli-core\azure\cli\core\_config.py" />
7376
<Compile Include="azure-cli-core\azure\cli\core\_debug.py" />
7477
<Compile Include="azure-cli-core\azure\cli\core\_environment.py" />
@@ -238,6 +241,7 @@
238241
<Compile Include="command_modules\azure-cli-cloud\setup.py" />
239242
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\commands.py" />
240243
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\custom.py" />
244+
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\tests\latest\test_api_properties.py" />
241245
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\tests\latest\test_cognitiveservices_command.py" />
242246
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\_client_factory.py" />
243247
<Compile Include="command_modules\azure-cli-cognitiveservices\azure\cli\command_modules\cognitiveservices\_help.py" />
@@ -405,6 +409,14 @@
405409
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\__init__.py" />
406410
<Compile Include="command_modules\azure-cli-interactive\azure_bdist_wheel.py" />
407411
<Compile Include="command_modules\azure-cli-interactive\setup.py" />
412+
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\commands.py" />
413+
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\custom.py" />
414+
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\tests\latest\test_iotcentral_commands.py" />
415+
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\_client_factory.py" />
416+
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\_help.py" />
417+
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\_params.py" />
418+
<Compile Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\__init__.py" />
419+
<Compile Include="command_modules\azure-cli-iotcentral\setup.py" />
408420
<Compile Include="command_modules\azure-cli-iot\azure\cli\command_modules\iot\custom.py" />
409421
<Compile Include="command_modules\azure-cli-iot\azure\cli\command_modules\iot\commands.py" />
410422
<Compile Include="command_modules\azure-cli-iot\azure\cli\command_modules\iot\mgmt_iot_hub_device\lib\credentials.py" />
@@ -480,6 +492,11 @@
480492
<Compile Include="command_modules\azure-cli-maps\__init__.py" />
481493
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\commands.py" />
482494
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\actions.py" />
495+
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertConditionLexer.py" />
496+
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertConditionListener.py" />
497+
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertConditionParser.py" />
498+
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertConditionValidator.py" />
499+
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\__init__.py" />
483500
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\action_groups.py" />
484501
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\activity_log.py" />
485502
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\activity_log_alerts.py" />
@@ -507,7 +524,6 @@
507524
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\_help.py" />
508525
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\_params.py" />
509526
<Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\__init__.py" />
510-
<Compile Include="command_modules\azure-cli-monitor\azure_bdist_wheel.py" />
511527
<Compile Include="command_modules\azure-cli-monitor\setup.py" />
512528
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\test_dns_commands.py" />
513529
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\test_network_commands.py" />
@@ -936,6 +952,13 @@
936952
<Folder Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\tests\" />
937953
<Folder Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\tests\latest\" />
938954
<Folder Include="command_modules\azure-cli-interactive\docs\" />
955+
<Folder Include="command_modules\azure-cli-iotcentral\" />
956+
<Folder Include="command_modules\azure-cli-iotcentral\azure\" />
957+
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\" />
958+
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\" />
959+
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\" />
960+
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\tests\" />
961+
<Folder Include="command_modules\azure-cli-iotcentral\azure\cli\command_modules\iotcentral\tests\latest\" />
939962
<Folder Include="command_modules\azure-cli-iot\" />
940963
<Folder Include="command_modules\azure-cli-iot\azure\" />
941964
<Folder Include="command_modules\azure-cli-iot\azure\cli\" />
@@ -984,6 +1007,7 @@
9841007
<Folder Include="command_modules\azure-cli-monitor\azure\cli\" />
9851008
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\" />
9861009
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\" />
1010+
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\" />
9871011
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\" />
9881012
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\tests\" />
9891013
<Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\tests\latest\" />
@@ -1228,6 +1252,7 @@
12281252
<Content Include="command_modules\azure-cli-interactive\README.md" />
12291253
<Content Include="command_modules\azure-cli-interactive\README.rst" />
12301254
<Content Include="command_modules\azure-cli-interactive\setup.cfg" />
1255+
<Content Include="command_modules\azure-cli-iotcentral\HISTORY.rst" />
12311256
<Content Include="command_modules\azure-cli-iot\azure\cli\command_modules\iot\mgmt_iot_hub_device\swagger_iot_hub_device_identity.json" />
12321257
<Content Include="command_modules\azure-cli-iot\HISTORY.rst" />
12331258
<Content Include="command_modules\azure-cli-keyvault\azure\cli\command_modules\keyvault\tests\latest\policy.json" />
@@ -1244,15 +1269,15 @@
12441269
<Content Include="command_modules\azure-cli-lab\README.rst" />
12451270
<Content Include="command_modules\azure-cli-lab\setup.cfg" />
12461271
<Content Include="command_modules\azure-cli-maps\HISTORY.rst" />
1272+
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\MetricAlertCondition.g4" />
1273+
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\build_python.bat" />
1274+
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\grammar\run_test.bat" />
12471275
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\operations\autoscale-parameters-template.json" />
12481276
<Content Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\_autoscale_util.py">
12491277
<SubType>Code</SubType>
12501278
</Content>
12511279
<Content Include="command_modules\azure-cli-monitor\HISTORY.rst" />
12521280
<Content Include="command_modules\azure-cli-monitor\linter_exclusions.yml" />
1253-
<Content Include="command_modules\azure-cli-monitor\MANIFEST.in" />
1254-
<Content Include="command_modules\azure-cli-monitor\README.rst" />
1255-
<Content Include="command_modules\azure-cli-monitor\setup.cfg" />
12561281
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\zone_files\fail1.txt" />
12571282
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\zone_files\fail2.txt" />
12581283
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\tests\latest\zone_files\fail3.txt" />

doc/authoring_command_modules/authoring_commands.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ The document provides instructions and guidelines on how to author individual co
3434

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

37+
[16. Deprecating Commands and Arguments](#deprecating-commands-and-arguments)
38+
3739
Authoring Commands
3840
=============================
3941

@@ -754,3 +756,51 @@ class MyCommandsLoader(AzCommandsLoader):
754756
reason='These commands are now in the CLI.',
755757
recommend_remove=True))
756758
```
759+
760+
## Deprecating Commands and Arguments
761+
762+
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:
763+
764+
- `target`: The thing being deprecated. This is often not needed as in most cases the CLI can figure out what is being deprecated.
765+
- `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.
766+
- `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.
767+
- `expiration`: Accepts a core CLI version at which the deprecated item will no longer function. This version will be communicated in all warning messages.
768+
769+
Deprecation of different command elements are usually accomplished using the `deprecate_info` kwarg in conjunction with a `deprecate` helper method.
770+
771+
***Deprecate Command Group***
772+
```Python
773+
with self.command_group('test', test_sdk, deprecate_info=self.deprecate(redirect='new-test', hide=True)) as g:
774+
g.show_command('show', 'get')
775+
g.command('list', 'list')
776+
```
777+
778+
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.```
779+
780+
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:
781+
782+
```This command has been implicitly deprecated because command group `test` is deprecated and will be removed in a future release. Use `new-test` instead.```
783+
784+
***Deprecate Command***
785+
```Python
786+
with self.command_group('test', test_sdk) as g:
787+
g.command('show-parameters', 'get_params', deprecate_info=g.deprecate(redirect='test show', expiration='2.1.0'))
788+
```
789+
790+
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.```
791+
792+
***Deprecate Argument***
793+
```Python
794+
with self.argument_context('test show-parameters') as c:
795+
c.argument('junk_flag', help='Something we no longer want to support.' deprecate_info=c.deprecate(expiration='2.1.0'))
796+
```
797+
798+
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.```
799+
800+
***Deprecate Argument Option***
801+
```Python
802+
with self.argument_context('test show-parameters') as c:
803+
c.argument('resource', options_list=['--resource', c.deprecate(target='--resource-id', redirect='--target')])
804+
```
805+
806+
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.

doc/sphinx/azhelpgen/doc_source_map.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"batchai": "src/command_modules/azure-cli-batchai/azure/cli/command_modules/batchai/_help.py",
1616
"backup": "src/command_modules/azure-cli-backup/azure/cli/command_modules/backup/_help.py",
1717
"billing": "src/command_modules/azure-cli-billing/azure/cli/command_modules/billing/_help.py",
18+
"botservice": "src/command_modules/azure-cli-botservice/azure/cli/command_modules/botservice/_help.py",
1819
"cdn": "src/command_modules/azure-cli-cdn/azure/cli/command_modules/cdn/_help.py",
1920
"cloud": "src/command_modules/azure-cli-cloud/azure/cli/command_modules/cloud/_help.py",
2021
"consumption": "src/command_modules/azure-cli-consumption/azure/cli/command_modules/consumption/_help.py",

scripts/ci/build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ testsrc_dir=$(cd artifacts/testsrc && pwd)
2020
script_dir=`cd $(dirname $0); pwd`
2121

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

scripts/ci/test_automation.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,24 @@ pip install -qqq $ALL_MODULES
3232
title 'Installed packages'
3333
pip freeze
3434

35+
if [ "$REDUCE_SDK" == "True" ]
36+
then
37+
title 'azure.mgmt file counts'
38+
(cd $(dirname $(which python)); cd ../lib/*/site-packages/azure/mgmt; find . -name '*.py' | wc)
39+
40+
python $(cd $(dirname $0); cd ..; pwd)/sdk_process/patch_models.py
41+
42+
title 'azure.mgmt file counts after reduce'
43+
(cd $(dirname $(which python)); cd ../lib/*/site-packages/azure/mgmt; find . -name '*.py' | wc)
44+
fi
45+
3546
target_profile=${AZURE_CLI_TEST_TARGET_PROFILE:-latest}
36-
if [ "$target_profile" != "latest" ]; then
47+
if [ "$target_profile" = "2017-03-09" ]; then
3748
# example: 2017-03-09-profile
3849
target_profile=$target_profile-profile
50+
elif [ "$target_profile" = "2018-03-01" ]
51+
then
52+
target_profile=$target_profile-hybrid
3953
fi
4054

4155
title 'Running tests'

scripts/move-tests.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ for test_folder in `find src/command_modules -name tests`; do
1313
cp -r $t/recordings/2017-03-09-profile/* $test_folder/profile_2017_03_09/recordings/
1414
fi
1515

16+
if [ -d $t/recordings/2018-03-01-hybrid ]; then
17+
mkdir -p $test_folder/hybrid_2018_03_01
18+
cp -r $t/* $test_folder/hybrid_2018_03_01
19+
rm -r $test_folder/hybrid_2018_03_01/recordings
20+
mkdir -p $test_folder/hybrid_2018_03_01/recordings
21+
cp -r $t/recordings/2018-03-01-hybrid/* $test_folder/hybrid_2018_03_01/recordings/
22+
fi
23+
1624
mkdir -p $test_folder/latest
1725
cp -r $t/* $test_folder/latest/
1826

0 commit comments

Comments
 (0)