Hello community, here is the log from the commit of package azure-cli-core for openSUSE:Factory checked in at 2020-03-11 18:53:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/azure-cli-core (Old) and /work/SRC/openSUSE:Factory/.azure-cli-core.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "azure-cli-core" Wed Mar 11 18:53:24 2020 rev:12 rq:783687 version:2.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/azure-cli-core/azure-cli-core.changes 2020-02-28 15:20:20.229770465 +0100 +++ /work/SRC/openSUSE:Factory/.azure-cli-core.new.3160/azure-cli-core.changes 2020-03-11 18:55:23.423676062 +0100 @@ -1,0 +2,9 @@ +Tue Mar 10 12:47:29 UTC 2020 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- New upstream release + + Version 2.2.0 + + For detailed information about changes see the + HISTORY.txt file provided with this package +- Update Requires from setup.py + +------------------------------------------------------------------- Old: ---- azure-cli-core-2.1.0.tar.gz New: ---- azure-cli-core-2.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ azure-cli-core.spec ++++++ --- /var/tmp/diff_new_pack.GPfr5O/_old 2020-03-11 18:55:24.143676385 +0100 +++ /var/tmp/diff_new_pack.GPfr5O/_new 2020-03-11 18:55:24.143676385 +0100 @@ -17,7 +17,7 @@ Name: azure-cli-core -Version: 2.1.0 +Version: 2.2.0 Release: 0 Summary: Microsoft Azure CLI Core Module License: MIT @@ -33,7 +33,8 @@ Requires: azure-cli-nspkg Requires: azure-cli-telemetry Requires: python3-PyJWT -Requires: python3-PyYAML +Requires: python3-PyYAML < 6.0 +Requires: python3-PyYAML >= 5.2 Requires: python3-adal < 2.0 Requires: python3-adal >= 1.2 Requires: python3-argcomplete < 2.0 @@ -53,6 +54,7 @@ Requires: python3-paramiko >= 2.0.8 Requires: python3-pip Requires: python3-pyOpenSSL >= 17.1.0 +Requires: python3-requests < 3.0.0 Requires: python3-requests >= 2.20.0 Requires: python3-six < 2.0.0 Requires: python3-six >= 1.12 ++++++ azure-cli-core-2.1.0.tar.gz -> azure-cli-core-2.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/HISTORY.rst new/azure-cli-core-2.2.0/HISTORY.rst --- old/azure-cli-core-2.1.0/HISTORY.rst 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/HISTORY.rst 2020-03-06 15:37:38.000000000 +0100 @@ -3,6 +3,10 @@ Release History =============== +2.2.0 +++++++ +* az cloud show: add application insights endpoint for China/US cloud + 2.1.0 ++++++ * Support `--output yamlc` for colorized YAML diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/PKG-INFO new/azure-cli-core-2.2.0/PKG-INFO --- old/azure-cli-core-2.1.0/PKG-INFO 2020-02-14 06:19:19.000000000 +0100 +++ new/azure-cli-core-2.2.0/PKG-INFO 2020-03-06 15:37:48.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: azure-cli-core -Version: 2.1.0 +Version: 2.2.0 Summary: Microsoft Azure Command-Line Tools Core Module Home-page: https://github.com/Azure/azure-cli Author: Microsoft Corporation @@ -15,6 +15,10 @@ Release History =============== + 2.2.0 + ++++++ + * az cloud show: add application insights endpoint for China/US cloud + 2.1.0 ++++++ * Support `--output yamlc` for colorized YAML diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure/cli/core/__init__.py new/azure-cli-core-2.2.0/azure/cli/core/__init__.py --- old/azure-cli-core-2.1.0/azure/cli/core/__init__.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure/cli/core/__init__.py 2020-03-06 15:37:38.000000000 +0100 @@ -4,7 +4,7 @@ # -------------------------------------------------------------------------------------------- from __future__ import print_function -__version__ = "2.1.0" +__version__ = "2.2.0" import os import sys diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure/cli/core/_help.py new/azure-cli-core-2.2.0/azure/cli/core/_help.py --- old/azure-cli-core-2.1.0/azure/cli/core/_help.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure/cli/core/_help.py 2020-03-06 15:37:38.000000000 +0100 @@ -78,7 +78,7 @@ from colorama import Style indent = 0 _print_indent('Examples', indent) - for e in AzCliHelp.example_provider(help_file): + for e in help_file.examples: indent = 1 _print_indent(u'{0}'.format(e.short_summary), indent) indent = 2 @@ -147,10 +147,21 @@ self._register_help_loaders() self._name_to_content = {} - # override def show_help(self, cli_name, nouns, parser, is_group): self.update_loaders_with_help_file_contents(nouns) - super(AzCliHelp, self).show_help(cli_name, nouns, parser, is_group) + + import colorama + colorama.init(autoreset=True) + delimiters = ' '.join(nouns) + help_file = self.command_help_cls(self, delimiters, parser) if not is_group \ + else self.group_help_cls(self, delimiters, parser) + help_file.load(parser) + if not nouns: + help_file.command = '' + else: + AzCliHelp.update_examples(help_file) + self._print_detailed_help(cli_name, help_file) + print(SURVEY_PROMPT) def _register_help_loaders(self): @@ -192,8 +203,8 @@ # This method is meant to be a hook that can be overridden by an extension or module. @staticmethod - def example_provider(help_file): - return help_file.examples + def update_examples(help_file): + pass class CliHelpFile(KnackHelpFile): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure/cli/core/_profile.py new/azure-cli-core-2.2.0/azure/cli/core/_profile.py --- old/azure-cli-core-2.1.0/azure/cli/core/_profile.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure/cli/core/_profile.py 2020-03-06 15:37:38.000000000 +0100 @@ -534,7 +534,10 @@ return parts[0], (None if len(parts) <= 1 else parts[1]) return None, None - def get_login_credentials(self, resource=None, subscription_id=None, aux_subscriptions=None): + def get_login_credentials(self, resource=None, subscription_id=None, aux_subscriptions=None, aux_tenants=None): + if aux_tenants and aux_subscriptions: + raise CLIError("Please specify only one of aux_subscriptions and aux_tenants, not both") + account = self.get_subscription(subscription_id) user_type = account[_USER_ENTITY][_USER_TYPE] username_or_sp_id = account[_USER_ENTITY][_USER_NAME] @@ -543,12 +546,14 @@ identity_type, identity_id = Profile._try_parse_msi_account_name(account) external_tenants_info = [] - ext_subs = [aux_sub for aux_sub in (aux_subscriptions or []) if aux_sub != subscription_id] - for ext_sub in ext_subs: - sub = self.get_subscription(ext_sub) - if sub[_TENANT_ID] != account[_TENANT_ID]: - # external_tenants_info.append((sub[_USER_ENTITY][_USER_NAME], sub[_TENANT_ID])) - external_tenants_info.append(sub) + if aux_tenants: + external_tenants_info = [tenant for tenant in aux_tenants if tenant != account[_TENANT_ID]] + if aux_subscriptions: + ext_subs = [aux_sub for aux_sub in aux_subscriptions if aux_sub != subscription_id] + for ext_sub in ext_subs: + sub = self.get_subscription(ext_sub) + if sub[_TENANT_ID] != account[_TENANT_ID]: + external_tenants_info.append(sub[_TENANT_ID]) if identity_type is None: def _retrieve_token(): @@ -564,13 +569,13 @@ def _retrieve_tokens_from_external_tenants(): external_tokens = [] - for s in external_tenants_info: + for sub_tenant_id in external_tenants_info: if user_type == _USER: external_tokens.append(self._creds_cache.retrieve_token_for_user( - username_or_sp_id, s[_TENANT_ID], resource)) + username_or_sp_id, sub_tenant_id, resource)) else: external_tokens.append(self._creds_cache.retrieve_token_for_service_principal( - username_or_sp_id, resource, s[_TENANT_ID], resource)) + username_or_sp_id, resource, sub_tenant_id, resource)) return external_tokens from azure.cli.core.adal_authentication import AdalAuthentication diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure/cli/core/cloud.py new/azure-cli-core-2.2.0/azure/cli/core/cloud.py --- old/azure-cli-core-2.1.0/azure/cli/core/cloud.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure/cli/core/cloud.py 2020-03-06 15:37:38.000000000 +0100 @@ -20,6 +20,9 @@ CLOUD_CONFIG_FILE = os.path.join(GLOBAL_CONFIG_DIR, 'clouds.config') +# Add names of clouds that don't allow telemetry data collection here such as JEDI. +CLOUDS_FORBIDDING_TELEMETRY = [] + class CloudNotRegisteredException(Exception): def __init__(self, cloud_name): @@ -68,7 +71,8 @@ media_resource_id=None, ossrdbms_resource_id=None, log_analytics_resource_id=None, - app_insights_resource_id=None): + app_insights_resource_id=None, + app_insights_telemetry_channel_resource_id=None): # Attribute names are significant. They are used when storing/retrieving clouds from config self.management = management self.resource_manager = resource_manager @@ -85,6 +89,7 @@ self.ossrdbms_resource_id = ossrdbms_resource_id self.log_analytics_resource_id = log_analytics_resource_id self.app_insights_resource_id = app_insights_resource_id + self.app_insights_telemetry_channel_resource_id = app_insights_telemetry_channel_resource_id def has_endpoint_set(self, endpoint_name): try: @@ -256,7 +261,8 @@ media_resource_id='https://rest.media.chinacloudapi.cn', ossrdbms_resource_id='https://ossrdbms-aad.database.chinacloudapi.cn', app_insights_resource_id='https://api.applicationinsights.azure.cn', - log_analytics_resource_id='https://api.loganalytics.azure.cn'), + log_analytics_resource_id='https://api.loganalytics.azure.cn', + app_insights_telemetry_channel_resource_id='https://dc.applicationinsights.azure.cn/v2/track'), suffixes=CloudSuffixes( storage_endpoint='core.chinacloudapi.cn', keyvault_dns='.vault.azure.cn', @@ -279,7 +285,8 @@ media_resource_id='https://rest.media.usgovcloudapi.net', ossrdbms_resource_id='https://ossrdbms-aad.database.usgovcloudapi.net', app_insights_resource_id='https://api.applicationinsights.us', - log_analytics_resource_id='https://api.loganalytics.us'), + log_analytics_resource_id='https://api.loganalytics.us', + app_insights_telemetry_channel_resource_id='https://dc.applicationinsights.us/v2/track'), suffixes=CloudSuffixes( storage_endpoint='core.usgovcloudapi.net', keyvault_dns='.vault.usgovcloudapi.net', @@ -526,3 +533,7 @@ config.remove_section(cloud_name) with open(CLOUD_CONFIG_FILE, 'w') as configfile: config.write(configfile) + + +def cloud_forbid_telemetry(cli_ctx): + return get_active_cloud_name(cli_ctx) in CLOUDS_FORBIDDING_TELEMETRY diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure/cli/core/commands/client_factory.py new/azure-cli-core-2.2.0/azure/cli/core/commands/client_factory.py --- old/azure-cli-core-2.1.0/azure/cli/core/commands/client_factory.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure/cli/core/commands/client_factory.py 2020-03-06 15:37:38.000000000 +0100 @@ -44,7 +44,7 @@ def get_mgmt_service_client(cli_ctx, client_or_resource_type, subscription_id=None, api_version=None, - aux_subscriptions=None, **kwargs): + aux_subscriptions=None, aux_tenants=None, **kwargs): """ :params subscription_id: the current account's subscription :param aux_subscriptions: mainly for cross tenant scenarios, say vnet peering. @@ -66,6 +66,7 @@ client, _ = _get_mgmt_service_client(cli_ctx, client_type, subscription_id=subscription_id, api_version=api_version, sdk_profile=sdk_profile, aux_subscriptions=aux_subscriptions, + aux_tenants=aux_tenants, **kwargs) return client @@ -118,13 +119,15 @@ resource=None, sdk_profile=None, aux_subscriptions=None, + aux_tenants=None, **kwargs): from azure.cli.core._profile import Profile logger.debug('Getting management service client client_type=%s', client_type.__name__) resource = resource or cli_ctx.cloud.endpoints.active_directory_resource_id profile = Profile(cli_ctx=cli_ctx) cred, subscription_id, _ = profile.get_login_credentials(subscription_id=subscription_id, resource=resource, - aux_subscriptions=aux_subscriptions) + aux_subscriptions=aux_subscriptions, + aux_tenants=aux_tenants) client_kwargs = {} if base_url_bound: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure/cli/core/commands/transform.py new/azure-cli-core-2.2.0/azure/cli/core/commands/transform.py --- old/azure-cli-core-2.1.0/azure/cli/core/commands/transform.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure/cli/core/commands/transform.py 2020-03-06 15:37:38.000000000 +0100 @@ -63,3 +63,13 @@ def _x509_from_base64_to_hex_transform(_, **kwargs): _add_x509_hex(kwargs['event_data']['result']) + + +def gen_dict_to_list_transform(key='value'): + + def _dict_to_list_transform(result): + if hasattr(result, key): + return getattr(result, key) + return result + + return _dict_to_list_transform diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure/cli/core/profiles/_shared.py new/azure-cli-core-2.2.0/azure/cli/core/profiles/_shared.py --- old/azure-cli-core-2.1.0/azure/cli/core/profiles/_shared.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure/cli/core/profiles/_shared.py 2020-03-06 15:37:38.000000000 +0100 @@ -138,13 +138,13 @@ ResourceType.MGMT_RESOURCE_RESOURCES: '2019-07-01', ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2019-06-01', ResourceType.MGMT_NETWORK_DNS: '2018-05-01', - ResourceType.MGMT_KEYVAULT: '2018-02-14', + ResourceType.MGMT_KEYVAULT: '2019-09-01', ResourceType.MGMT_AUTHORIZATION: SDKProfile('2018-09-01-preview', { 'classic_administrators': '2015-06-01', 'role_definitions': '2018-01-01-preview', 'provider_operations_metadata': '2018-01-01-preview' }), - ResourceType.MGMT_CONTAINERREGISTRY: '2019-06-01-preview', + ResourceType.MGMT_CONTAINERREGISTRY: '2019-12-01-preview', ResourceType.DATA_KEYVAULT: '7.0', ResourceType.DATA_STORAGE: '2018-11-09', ResourceType.DATA_COSMOS_TABLE: '2017-04-17', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure/cli/core/telemetry.py new/azure-cli-core-2.2.0/azure/cli/core/telemetry.py --- old/azure-cli-core-2.1.0/azure/cli/core/telemetry.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure/cli/core/telemetry.py 2020-03-06 15:37:38.000000000 +0100 @@ -204,7 +204,7 @@ def _user_agrees_to_telemetry(func): @wraps(func) def _wrapper(*args, **kwargs): - if not _get_config().getboolean('core', 'collect_telemetry', fallback=True): + if not is_telemetry_enabled(): return None return func(*args, **kwargs) @@ -358,6 +358,14 @@ }) +@decorators.suppress_all_exceptions() +def is_telemetry_enabled(): + from azure.cli.core.cloud import cloud_forbid_telemetry + if cloud_forbid_telemetry(_session.application): + return False + return _get_config().getboolean('core', 'collect_telemetry', fallback=True) + + # definitions @decorators.call_once diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure/cli/core/util.py new/azure-cli-core-2.2.0/azure/cli/core/util.py --- old/azure-cli-core-2.1.0/azure/cli/core/util.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure/cli/core/util.py 2020-03-06 15:37:38.000000000 +0100 @@ -12,6 +12,7 @@ import platform import ssl import six +import re from six.moves.urllib.request import urlopen # pylint: disable=import-error from knack.log import get_logger @@ -29,6 +30,12 @@ 'Please add this certificate to the trusted CA bundle: https://github.com/Azure/azure-cli/blob/dev/doc/use_cli_effectively.md#working-behind-a-proxy. ' 'Error detail: {}') +_PROXYID_RE = re.compile( + '(?i)/subscriptions/(?P<subscription>[^/]*)(/resourceGroups/(?P<resource_group>[^/]*))?' + '(/providers/(?P<namespace>[^/]*)/(?P<type>[^/]*)/(?P<name>[^/]*)(?P<children>.*))?') + +_CHILDREN_RE = re.compile('(?i)/(?P<child_type>[^/]*)/(?P<child_name>[^/]*)') + def handle_exception(ex): # pylint: disable=too-many-return-statements # For error code, follow guidelines at https://docs.python.org/2/library/sys.html#sys.exit, @@ -654,3 +661,39 @@ def urlretrieve(url): req = urlopen(url, context=_ssl_context()) return req.read() + + +def parse_proxy_resource_id(rid): + """Parses a resource_id into its various parts. + + Return an empty dictionary, if invalid resource id. + + :param rid: The resource id being parsed + :type rid: str + :returns: A dictionary with with following key/value pairs (if found): + + - subscription: Subscription id + - resource_group: Name of resource group + - namespace: Namespace for the resource provider (i.e. Microsoft.Compute) + - type: Type of the root resource (i.e. virtualMachines) + - name: Name of the root resource + - child_type_{level}: Type of the child resource of that level + - child_name_{level}: Name of the child resource of that level + - last_child_num: Level of the last child + + :rtype: dict[str,str] + """ + if not rid: + return {} + match = _PROXYID_RE.match(rid) + if match: + result = match.groupdict() + children = _CHILDREN_RE.finditer(result['children'] or '') + count = None + for count, child in enumerate(children): + result.update({ + key + '_%d' % (count + 1): group for key, group in child.groupdict().items()}) + result['last_child_num'] = count + 1 if isinstance(count, int) else None + result.pop('children', None) + return {key: value for key, value in result.items() if value is not None} + return None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure_cli_core.egg-info/PKG-INFO new/azure-cli-core-2.2.0/azure_cli_core.egg-info/PKG-INFO --- old/azure-cli-core-2.1.0/azure_cli_core.egg-info/PKG-INFO 2020-02-14 06:19:19.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure_cli_core.egg-info/PKG-INFO 2020-03-06 15:37:48.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: azure-cli-core -Version: 2.1.0 +Version: 2.2.0 Summary: Microsoft Azure Command-Line Tools Core Module Home-page: https://github.com/Azure/azure-cli Author: Microsoft Corporation @@ -15,6 +15,10 @@ Release History =============== + 2.2.0 + ++++++ + * az cloud show: add application insights endpoint for China/US cloud + 2.1.0 ++++++ * Support `--output yamlc` for colorized YAML diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/azure_cli_core.egg-info/requires.txt new/azure-cli-core-2.2.0/azure_cli_core.egg-info/requires.txt --- old/azure-cli-core-2.1.0/azure_cli_core.egg-info/requires.txt 2020-02-14 06:19:19.000000000 +0100 +++ new/azure-cli-core-2.2.0/azure_cli_core.egg-info/requires.txt 2020-03-06 15:37:48.000000000 +0100 @@ -10,7 +10,7 @@ paramiko<3.0.0,>=2.0.8 PyJWT pyopenssl>=17.1.0 -pyyaml +pyyaml~=5.2 requests~=2.20 six~=1.12 wheel==0.30.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.1.0/setup.py new/azure-cli-core-2.2.0/setup.py --- old/azure-cli-core-2.1.0/setup.py 2020-02-14 06:19:06.000000000 +0100 +++ new/azure-cli-core-2.2.0/setup.py 2020-03-06 15:37:38.000000000 +0100 @@ -17,7 +17,7 @@ logger.warn("Wheel is not available, disabling bdist_wheel hook") cmdclass = {} -VERSION = "2.1.0" +VERSION = "2.2.0" # If we have source, validate that our version numbers match # This should prevent uploading releases with mismatched versions. try: @@ -63,7 +63,7 @@ 'paramiko>=2.0.8,<3.0.0', 'PyJWT', 'pyopenssl>=17.1.0', # https://github.com/pyca/pyopenssl/pull/612 - 'pyyaml', + 'pyyaml~=5.2', 'requests~=2.20', 'six~=1.12', 'wheel==0.30.0',