Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
78e954c
Adding ACR and AKS for azurestack hybrid profile
May 18, 2021
65fd82a
Change managed cluster SDK profile for acs
May 19, 2021
e31c68f
Container service resource type to managed cluster sdk
May 21, 2021
c1d3fdc
Removing hardcoded api-version to import models
May 21, 2021
7fcc7fc
Removing versioned models import
May 27, 2021
19ac1f2
Removing versioned models import
May 28, 2021
ae844d4
Fixing style and models
May 28, 2021
f76fc0c
Changing Azure stack API version for container service
May 28, 2021
bba1cd3
Adding operation-group to container service
Jun 1, 2021
d96d92e
Changing container service test_validator
Jun 1, 2021
0b0cde5
Changing container service test_validator
Jun 1, 2021
dde88da
Modifying operation_group to managed_clusters
Jun 2, 2021
55d8260
Adding managed_clusters operation group to aks run command
Jun 2, 2021
c551f3b
Container service test code changes
Jun 2, 2021
aa50108
Revert "Container service test code changes"
Jun 2, 2021
124fcd4
Adding mock cmd to acs test
Jun 3, 2021
20a60f0
Fix resource tyope in acs test
Jun 3, 2021
4c206ea
Fix resource tyope in acs test
Jun 3, 2021
98bd825
Removing resource type in mock cmd
Jun 3, 2021
990dcf0
Changing acs get_models
Jun 4, 2021
a648103
Adding operation group to get_models
Jun 4, 2021
e01899e
Adding magicmock to acs test
Jun 5, 2021
0f152fc
Ading magicmock to acs test
Jun 5, 2021
c0ac58d
Modifying mock cmd
Jun 5, 2021
f1b643f
Modifying acs mock cmd
Jun 5, 2021
e8eb6a0
Adding operation_group to acs mock
Jun 5, 2021
fed1fc1
Adding mod=models for acs mock cmd
Jun 5, 2021
e00e9c9
Changing hybrid authorization api-version
Jun 10, 2021
b6eb4fc
Adding test for acs and acr hybrid profiles
Jun 10, 2021
9195f70
Adding aks acr hybrid profiles
Jun 12, 2021
bc7c74a
removing redundant operation_group properties
Jun 15, 2021
668ad41
Adding operation_group to acs loadbalancer
Jun 15, 2021
3b17a5f
{Packaging} Bump PyJWT to 2.1.0 (#18506)
jiasli Jun 18, 2021
afbc53a
{Packaging} Be more strict on `requests` (#18518)
jiasli Jun 18, 2021
8f15a1a
{Misc.} Fix typos in HISTORY.rst (#18504)
jiasli Jun 18, 2021
8481a92
{Pylint} Fix `use-a-generator` (#18523)
jiasli Jun 18, 2021
e761d4b
{Core} `az extension`: Retry `shutil.rmtree` (#18061)
jiasli Jun 18, 2021
594bfac
Remove preview out of security module (#18529)
a7mad-3bbas Jun 18, 2021
00dc886
{AppService} Make `appservice` tests serial (#18534)
jiasli Jun 18, 2021
57f34e8
Merge dev
Jun 18, 2021
41fcdf9
Merge hybrid test
Jun 18, 2021
513dd13
ACR check_health changes
Jun 18, 2021
5d55426
Style check changes
Jun 18, 2021
993bdb4
Removing unsed models
Jun 18, 2021
5068786
Mergin dev changes
Jun 18, 2021
8941a56
Changes to hybrid profile test
Jun 19, 2021
39428f8
Acs hybrid test changes
Jun 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ reports=no
disable=
arguments-out-of-order,
bad-option-value,
consider-using-generator,
consider-using-with,
cyclic-import,
duplicate-code,
Expand All @@ -32,7 +31,6 @@ disable=
too-many-arguments,
too-many-function-args,
too-many-lines,
use-a-generator,
using-constant-test,
wrong-import-order,

Expand Down
2 changes: 1 addition & 1 deletion scripts/release/rpm/test_rpm_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd)

for mod_name in mod_list:
if mod_name in ['botservice', 'network', 'cloud']:
if mod_name in ['botservice', 'network', 'cloud', 'appservice']:
exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_base_cmd, mod_name, mod_name)], shell=True)
else:
exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_parallel_cmd, mod_name, mod_name)], shell=True)
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli-core/azure/cli/core/_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def find_subscriptions_in_vm_with_msi(self, identity_id=None, allow_no_subscript
token_entry = msi_creds.token
token = token_entry['access_token']
logger.info('MSI: token was retrieved. Now trying to initialize local accounts...')
decode = jwt.decode(token, verify=False, algorithms=['RS256'])
decode = jwt.decode(token, algorithms=['RS256'], options={"verify_signature": False})
tenant = decode['tid']

subscription_finder = SubscriptionFinder(self.cli_ctx, self.auth_ctx_factory, None)
Expand All @@ -382,7 +382,7 @@ def find_subscriptions_in_cloud_console(self):

_, token, _ = self._get_token_from_cloud_shell(self.cli_ctx.cloud.endpoints.active_directory_resource_id)
logger.info('MSI: token was retrieved. Now trying to initialize local accounts...')
decode = jwt.decode(token, verify=False, algorithms=['RS256'])
decode = jwt.decode(token, algorithms=['RS256'], options={"verify_signature": False})
tenant = decode['tid']

subscription_finder = SubscriptionFinder(self.cli_ctx, self.auth_ctx_factory, None)
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _expand_file_prefix(arg):
except IndexError:
return _maybe_load_file(arg_split[0])

return list([_expand_file_prefix(arg) for arg in args])
return [_expand_file_prefix(arg) for arg in args]


def _pre_command_table_create(cli_ctx, args):
Expand Down
33 changes: 24 additions & 9 deletions src/azure-cli-core/azure/cli/core/extension/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _validate_whl_extension(ext_file):
zip_ref.extractall(tmp_dir)
zip_ref.close()
azext_metadata = WheelExtension.get_azext_metadata(tmp_dir)
shutil.rmtree(tmp_dir)
rmtree_with_retry(tmp_dir)
check_version_compatibility(azext_metadata)


Expand Down Expand Up @@ -169,7 +169,7 @@ def _add_whl_ext(cli_ctx, source, ext_sha256=None, pip_extra_index_urls=None, pi
pip_status_code = _run_pip(pip_args, extension_path)
if pip_status_code > 0:
logger.debug('Pip failed so deleting anything we might have installed at %s', extension_path)
shutil.rmtree(extension_path, ignore_errors=True)
rmtree_with_retry(extension_path)
raise CLIError('An error occurred. Pip failed with status code {}. '
'Use --debug for more information.'.format(pip_status_code))
# Save the whl we used to install the extension in the extension dir.
Expand Down Expand Up @@ -351,10 +351,6 @@ def add_extension(cmd=None, source=None, extension_name=None, index_url=None, ye


def remove_extension(extension_name):
def log_err(func, path, exc_info):
logger.warning("Error occurred attempting to delete item from the extension '%s'.", extension_name)
logger.warning("%s: %s - %s", func, path, exc_info)

try:
# Get the extension and it will raise an error if it doesn't exist
ext = get_extension(extension_name)
Expand All @@ -364,7 +360,7 @@ def log_err(func, path, exc_info):
"`azdev extension remove {name}`".format(name=extension_name))
# We call this just before we remove the extension so we can get the metadata before it is gone
_augment_telemetry_with_ext_info(extension_name, ext)
shutil.rmtree(ext.path, onerror=log_err)
rmtree_with_retry(ext.path)
CommandIndex().invalidate()
except ExtensionNotInstalledException as e:
raise CLIError(e)
Expand Down Expand Up @@ -408,13 +404,13 @@ def update_extension(cmd=None, extension_name=None, index_url=None, pip_extra_in
logger.debug('Backing up the current extension: %s to %s', extension_path, backup_dir)
shutil.copytree(extension_path, backup_dir)
# Remove current version of the extension
shutil.rmtree(extension_path)
rmtree_with_retry(extension_path)
# Install newer version
try:
_add_whl_ext(cli_ctx=cmd_cli_ctx, source=download_url, ext_sha256=ext_sha256,
pip_extra_index_urls=pip_extra_index_urls, pip_proxy=pip_proxy)
logger.debug('Deleting backup of old extension at %s', backup_dir)
shutil.rmtree(backup_dir)
rmtree_with_retry(backup_dir)
except Exception as err:
logger.error('An error occurred whilst updating.')
logger.error(err)
Expand Down Expand Up @@ -563,3 +559,22 @@ def check_distro_consistency():
"for your distribution or change the above file accordingly.")
logger.debug("Linux distro check: %s has '%s', current distro is '%s'",
LIST_FILE_PATH, stored_linux_dist_name, current_linux_dist_name)


def rmtree_with_retry(path):
# A workaround for https://bugs.python.org/issue33240
# Retry shutil.rmtree several times, but even if it fails after several retries, don't block the command execution.
retry_num = 3
import time
while True:
try:
shutil.rmtree(path)
return
except OSError as err:
if retry_num > 0:
logger.warning("Failed to delete '%s': %s. Retrying ...", path, err)
retry_num -= 1
time.sleep(1)
else:
logger.warning("Failed to delete '%s': %s. You may try to delete it manually.", path, err)
break
17 changes: 13 additions & 4 deletions src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ class ResourceType(Enum): # pylint: disable=too-few-public-methods
MGMT_ARO = ('azure.mgmt.redhatopenshift', 'AzureRedHatOpenShiftClient')
MGMT_DATABOXEDGE = ('azure.mgmt.databoxedge', 'DataBoxEdgeManagementClient')
MGMT_CUSTOMLOCATION = ('azure.mgmt.extendedlocation', 'CustomLocations')
MGMT_CONTAINERSERVICE = ('azure.mgmt.containerservice', 'ContainerServiceClient')
# the "None" below will stay till a command module fills in the type so "get_mgmt_service_client"
# can be provided with "ResourceType.XXX" to initialize the client object. This usually happens
# when related commands start to support Multi-API

DATA_COSMOS_TABLE = ('azure.multiapi.cosmosdb', None)
MGMT_CONTAINERSERVICE = ('azure.mgmt.containerservice', None)
MGMT_ADVISOR = ('azure.mgmt.advisor', None)
MGMT_MEDIA = ('azure.mgmt.media', None)
MGMT_BACKUP = ('azure.mgmt.recoveryservicesbackup', None)
Expand Down Expand Up @@ -212,7 +212,11 @@ def default_api_version(self):
ResourceType.MGMT_IOTHUB: '2021-03-31',
ResourceType.MGMT_ARO: '2020-04-30',
ResourceType.MGMT_DATABOXEDGE: '2019-08-01',
ResourceType.MGMT_CUSTOMLOCATION: '2021-03-15-preview'
ResourceType.MGMT_CUSTOMLOCATION: '2021-03-15-preview',
ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2021-03-01', {
'container_services': '2017-07-01',
'open_shift_managed_clusters': '2019-10-27-preview'
})
},
'2020-09-01-hybrid': {
ResourceType.MGMT_STORAGE: '2019-06-01',
Expand All @@ -237,7 +241,7 @@ def default_api_version(self):
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2016-06-01',
ResourceType.MGMT_RESOURCE_TEMPLATESPECS: '2015-01-01',
ResourceType.MGMT_NETWORK_DNS: '2016-04-01',
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2016-09-01', {
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01', {
'classic_administrators': '2015-06-01',
'policy_assignments': '2016-12-01',
'policy_definitions': '2016-12-01'
Expand All @@ -252,7 +256,12 @@ def default_api_version(self):
ResourceType.MGMT_APPSERVICE: '2018-02-01',
ResourceType.MGMT_EVENTHUB: '2018-01-01-preview',
ResourceType.MGMT_IOTHUB: '2019-07-01-preview',
ResourceType.MGMT_DATABOXEDGE: '2019-08-01'
ResourceType.MGMT_DATABOXEDGE: '2019-08-01',
ResourceType.MGMT_CONTAINERREGISTRY: '2019-05-01',
ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2020-11-01', {
'container_services': '2017-07-01',
'open_shift_managed_clusters': '2019-10-27-preview'
})
},
'2019-03-01-hybrid': {
ResourceType.MGMT_STORAGE: '2017-10-01',
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli-core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
'msal>=1.10.0,<2.0.0',
'paramiko>=2.0.8,<3.0.0',
'pkginfo>=1.5.0.1',
'PyJWT==1.7.1',
'PyJWT>=2.1.0',
'pyopenssl>=17.1.0', # https://github.com/pyca/pyopenssl/pull/612
'requests~=2.22',
'requests~=2.25.1',
'six~=1.12',
'urllib3[secure]>=1.26.5',
]
Expand Down
Loading