Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package azure-cli-core for openSUSE:Factory checked in at 2023-02-11 21:57:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/azure-cli-core (Old) and /work/SRC/openSUSE:Factory/.azure-cli-core.new.1848 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "azure-cli-core" Sat Feb 11 21:57:03 2023 rev:49 rq:1064303 version:2.45.0 Changes: -------- --- /work/SRC/openSUSE:Factory/azure-cli-core/azure-cli-core.changes 2023-01-19 16:44:24.973835223 +0100 +++ /work/SRC/openSUSE:Factory/.azure-cli-core.new.1848/azure-cli-core.changes 2023-02-11 21:57:42.671767400 +0100 @@ -1,0 +2,8 @@ +Thu Feb 9 21:04:52 UTC 2023 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- New upstream release + + Version 2.45.0 + + For detailed information about changes see the + HISTORY.rst file provided with this package + +------------------------------------------------------------------- Old: ---- azure-cli-core-2.44.1.tar.gz New: ---- azure-cli-core-2.45.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ azure-cli-core.spec ++++++ --- /var/tmp/diff_new_pack.DwZam0/_old 2023-02-11 21:57:43.139770313 +0100 +++ /var/tmp/diff_new_pack.DwZam0/_new 2023-02-11 21:57:43.143770338 +0100 @@ -17,7 +17,7 @@ Name: azure-cli-core -Version: 2.44.1 +Version: 2.45.0 Release: 0 Summary: Microsoft Azure CLI Core Module License: MIT ++++++ azure-cli-core-2.44.1.tar.gz -> azure-cli-core-2.45.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/HISTORY.rst new/azure-cli-core-2.45.0/HISTORY.rst --- old/azure-cli-core-2.44.1/HISTORY.rst 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/HISTORY.rst 2023-02-03 10:37:38.000000000 +0100 @@ -3,6 +3,11 @@ Release History =============== +2.45.0 +++++++ +* `aaz`: Support AAZFileArg (#25075) +* `aaz`: Support singular options of `AAZListArg` in shorthand syntax partial value expression (#25302) + 2.44.1 ++++++ * No changes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/PKG-INFO new/azure-cli-core-2.45.0/PKG-INFO --- old/azure-cli-core-2.44.1/PKG-INFO 2023-01-10 16:46:39.006603000 +0100 +++ new/azure-cli-core-2.45.0/PKG-INFO 2023-02-03 10:38:12.493968200 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: azure-cli-core -Version: 2.44.1 +Version: 2.45.0 Summary: Microsoft Azure Command-Line Tools Core Module Home-page: https://github.com/Azure/azure-cli Author: Microsoft Corporation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/__init__.py new/azure-cli-core-2.45.0/azure/cli/core/__init__.py --- old/azure-cli-core-2.44.1/azure/cli/core/__init__.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/__init__.py 2023-02-03 10:37:38.000000000 +0100 @@ -4,7 +4,7 @@ # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long -__version__ = "2.44.1" +__version__ = "2.45.0" import os import sys diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/aaz/__init__.py new/azure-cli-core-2.45.0/azure/cli/core/aaz/__init__.py --- old/azure-cli-core-2.44.1/azure/cli/core/aaz/__init__.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/aaz/__init__.py 2023-02-03 10:37:38.000000000 +0100 @@ -12,11 +12,11 @@ from ._arg import AAZArgumentsSchema, AAZArgEnum, AAZStrArg, AAZIntArg, AAZObjectArg, AAZDictArg, \ AAZFreeFormDictArg, AAZFloatArg, AAZBaseArg, AAZBoolArg, AAZListArg, AAZResourceGroupNameArg, \ AAZResourceLocationArg, AAZResourceIdArg, AAZSubscriptionIdArg, AAZUuidArg, AAZDateArg, AAZTimeArg, \ - AAZDateTimeArg, AAZDurationArg + AAZDateTimeArg, AAZDurationArg, AAZFileArg from ._arg_fmt import AAZStrArgFormat, AAZIntArgFormat, AAZFloatArgFormat, AAZBoolArgFormat, AAZObjectArgFormat, \ AAZDictArgFormat, AAZFreeFormDictArgFormat, AAZListArgFormat, AAZResourceLocationArgFormat, \ AAZResourceIdArgFormat, AAZSubscriptionIdArgFormat, AAZUuidFormat, AAZDateFormat, AAZTimeFormat, \ - AAZDateTimeFormat, AAZDurationFormat + AAZDateTimeFormat, AAZDurationFormat, AAZFileArgTextFormat, AAZFileArgBase64EncodeFormat, AAZFileArgFormat from ._base import has_value, AAZValuePatch, AAZUndefined from ._command import AAZCommand, AAZWaitCommand, AAZCommandGroup, \ register_callback, register_command, register_command_group, load_aaz_command_table diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/aaz/_arg.py new/azure-cli-core-2.45.0/azure/cli/core/aaz/_arg.py --- old/azure-cli-core-2.44.1/azure/cli/core/aaz/_arg.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/aaz/_arg.py 2023-02-03 10:37:38.000000000 +0100 @@ -19,7 +19,7 @@ from ._field_value import AAZObject from ._arg_fmt import AAZObjectArgFormat, AAZListArgFormat, AAZDictArgFormat, AAZFreeFormDictArgFormat, \ AAZSubscriptionIdArgFormat, AAZResourceLocationArgFormat, AAZResourceIdArgFormat, AAZUuidFormat, AAZDateFormat, \ - AAZTimeFormat, AAZDateTimeFormat, AAZDurationFormat + AAZTimeFormat, AAZDateTimeFormat, AAZDurationFormat, AAZFileArgTextFormat from .exceptions import AAZUnregisteredArg # pylint: disable=redefined-builtin, protected-access, too-few-public-methods @@ -520,6 +520,13 @@ return arg +class AAZFileArg(AAZStrArg): + + def __init__(self, fmt=None, **kwargs): + fmt = fmt or AAZFileArgTextFormat() + super().__init__(fmt=fmt, **kwargs) + + # Generic Update arguments class AAZGenericUpdateForceStringArg(AAZBoolArg): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/aaz/_arg_action.py new/azure-cli-core-2.45.0/azure/cli/core/aaz/_arg_action.py --- old/azure-cli-core-2.44.1/azure/cli/core/aaz/_arg_action.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/aaz/_arg_action.py 2023-02-03 10:37:38.000000000 +0100 @@ -16,7 +16,7 @@ from ._base import AAZUndefined, AAZBlankArgValue from ._help import AAZShowHelp from ._utils import AAZShortHandSyntaxParser -from .exceptions import AAZInvalidShorthandSyntaxError, AAZInvalidValueError +from .exceptions import AAZInvalidShorthandSyntaxError, AAZInvalidValueError, AAZUnknownFieldError logger = get_logger(__name__) @@ -64,13 +64,14 @@ setattr(namespace, self.dest, AAZArgActionOperations()) dest_ops = getattr(namespace, self.dest) try: - self.setup_operations(dest_ops, values) + try: + self.setup_operations(dest_ops, values) + except AAZShowHelp as aaz_help: + # show help message + aaz_help.keys = (option_string, *aaz_help.keys) + self.show_aaz_help(parser, aaz_help) # may raise AAZUnknownFieldError except (ValueError, KeyError) as ex: raise azclierror.InvalidArgumentValueError(f"Failed to parse '{option_string}' argument: {ex}") from ex - except AAZShowHelp as aaz_help: - # show help message - aaz_help.keys = (option_string, *aaz_help.keys) - self.show_aaz_help(parser, aaz_help) @classmethod def setup_operations(cls, dest_ops, values, prefix_keys=None): @@ -165,50 +166,78 @@ def decode_values(cls, values): for v in values: key, key_parts, v = cls._str_parser.split_partial_value(v) - v = cls._decode_value(key, key_parts, v) + key_parts, schema = cls.get_schema_by_key_items(key_parts, cls._schema) + + try: + v = cls._decode_value(schema, v) + except AAZShowHelp as aaz_help: + aaz_help.schema = cls._schema + aaz_help.keys = (*key_parts, *aaz_help.keys) + raise aaz_help + yield key, key_parts, v + @staticmethod + def get_schema_by_key_items(key_items, schema): + if not key_items: + return key_items, schema + + valid_key_items = [] + for item in key_items: + try: + schema = schema[item] + valid_key_items.append(item) + except AAZUnknownFieldError as err: + from ._arg import AAZObjectArg, AAZListArg + if not isinstance(schema, AAZObjectArg): + raise err + is_singular = False + for field_name, field in schema._fields.items(): + if not isinstance(field, AAZListArg): + continue + if field.singular_options and item in field.singular_options: + valid_key_items.append(field_name) + schema = field.Element + valid_key_items.append(_ELEMENT_APPEND_KEY) + is_singular = True + break + if not is_singular: + raise err + return tuple(valid_key_items), schema + @classmethod - def _decode_value(cls, key, key_items, value): # pylint: disable=unused-argument + def _decode_value(cls, schema, value): # pylint: disable=unused-argument from ._arg import AAZSimpleTypeArg from azure.cli.core.util import get_file_json, shell_safe_json_parse, get_file_yaml - schema = cls._schema - for item in key_items: - schema = schema[item] # pylint: disable=unsubscriptable-object - if len(value) == 0: # the express "a=" will return the blank value of schema 'a' return AAZBlankArgValue - try: - if isinstance(schema, AAZSimpleTypeArg): - # simple type - v = cls._str_parser(value, is_simple=True) - else: - # compound type - # read from file - path = os.path.expanduser(value) - if os.path.exists(path): - if path.endswith('.yml') or path.endswith('.yaml'): - # read from yaml file - v = get_file_yaml(path) - else: - # read from json file - v = get_file_json(path, preserve_order=True) + if isinstance(schema, AAZSimpleTypeArg): + # simple type + v = cls._str_parser(value, is_simple=True) + else: + # compound type + # read from file + path = os.path.expanduser(value) + if os.path.exists(path): + if path.endswith('.yml') or path.endswith('.yaml'): + # read from yaml file + v = get_file_yaml(path) else: + # read from json file + v = get_file_json(path, preserve_order=True) + else: + try: + v = cls._str_parser(value) + except AAZInvalidShorthandSyntaxError as shorthand_ex: try: - v = cls._str_parser(value) - except AAZInvalidShorthandSyntaxError as shorthand_ex: - try: - v = shell_safe_json_parse(value, True) - except Exception as ex: - logger.debug(ex) # log parse json failed expression - raise shorthand_ex # raise shorthand syntax exception - except AAZShowHelp as aaz_help: - aaz_help.schema = cls._schema - aaz_help.keys = (*key_items, *aaz_help.keys) - raise aaz_help + v = shell_safe_json_parse(value, True) + except Exception as ex: + logger.debug(ex) # log parse json failed expression + raise shorthand_ex # raise shorthand syntax exception + return v @@ -322,7 +351,14 @@ if self._schema.singular_options and option_string in self._schema.singular_options: # if singular option is used then parsed values by element action action = self._schema.Element._build_cmd_action() - action.setup_operations(dest_ops, values, prefix_keys=[_ELEMENT_APPEND_KEY]) + if isinstance(values, list) and len(values) > 1: + # append element + action.setup_operations(dest_ops, values[:1], prefix_keys=[_ELEMENT_APPEND_KEY]) + # apply on the last element + action.setup_operations(dest_ops, values[1:], prefix_keys=[-1]) + else: + # append element + action.setup_operations(dest_ops, values, prefix_keys=[_ELEMENT_APPEND_KEY]) else: self.setup_operations(dest_ops, values) except (ValueError, KeyError) as ex: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/aaz/_arg_fmt.py new/azure-cli-core-2.45.0/azure/cli/core/aaz/_arg_fmt.py --- old/azure-cli-core-2.44.1/azure/cli/core/aaz/_arg_fmt.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/aaz/_arg_fmt.py 2023-02-03 10:37:38.000000000 +0100 @@ -5,6 +5,7 @@ # pylint: disable=line-too-long, too-few-public-methods import abc +import os.path import re import math @@ -718,3 +719,50 @@ else: logger.warning("Subscription '%s' not recognized.", value._data) return value + + +class AAZFileArgFormat(AAZBaseArgFormat): + + def __call__(self, ctx, value): + assert isinstance(value, AAZSimpleValue) + data = value._data + if data == AAZUndefined or data is None or value._is_patch: + return value + + assert isinstance(data, str) + + if not os.path.isfile(data): + raise AAZInvalidArgValueError("File '{}' doesn't exist".format(data)) + + data = self.read_file(data) + value._data = data + return value + + @abc.abstractmethod + def read_file(self, file_path): + raise NotImplementedError() + + +class AAZFileArgTextFormat(AAZFileArgFormat): + + def __init__(self, encoding=None): + self._encoding = encoding # use platform default encoding when it's None + + def read_file(self, file_path): + with open(file_path, 'r', encoding=self._encoding) as f: + data = f.read() + return data + + +class AAZFileArgBase64EncodeFormat(AAZFileArgFormat): + + def read_file(self, file_path): + import base64 + with open(file_path, 'rb') as f: + contents = f.read() + base64_data = base64.b64encode(contents) + try: + data = base64_data.decode('utf-8') + except UnicodeDecodeError: + data = str(base64_data) + return data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/azclierror.py new/azure-cli-core-2.45.0/azure/cli/core/azclierror.py --- old/azure-cli-core-2.44.1/azure/cli/core/azclierror.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/azclierror.py 2023-02-03 10:37:38.000000000 +0100 @@ -62,6 +62,11 @@ def print_error(self): from azure.cli.core.azlogging import CommandLoggerContext from azure.cli.core.style import print_styled_text + + # Print the traceback and exception message to debug log + import traceback + logger.debug(traceback.format_exc()) + with CommandLoggerContext(logger): # print error message logger.error(self.error_msg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/command_recommender.py new/azure-cli-core-2.45.0/azure/cli/core/command_recommender.py --- old/azure-cli-core-2.44.1/azure/cli/core/command_recommender.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/command_recommender.py 2023-02-03 10:37:38.000000000 +0100 @@ -338,6 +338,7 @@ 1. CLI context is missing 2. In air-gapped clouds 3. In testing environments + 4. In autocomplete mode :return: whether Aladdin service need to be disabled or not :type: bool @@ -357,6 +358,9 @@ if self.cli_ctx.__class__.__name__ == 'DummyCli': return True + if self.cli_ctx.data['completer_active']: + return True + return False def _normalize_parameters(self, args): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/extension/operations.py new/azure-cli-core-2.45.0/azure/cli/core/extension/operations.py --- old/azure-cli-core-2.44.1/azure/cli/core/extension/operations.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/extension/operations.py 2023-02-03 10:37:38.000000000 +0100 @@ -111,7 +111,7 @@ raise CLIError('Unable to determine extension name from {}. Is the file name correct?'.format(source)) if extension_exists(extension_name, ext_type=WheelExtension): raise CLIError('The extension {} already exists.'.format(extension_name)) - if extension_name == 'rdbms-connect': + if extension_name == 'rdbms-connect' or extension_name == 'serviceconnector-passwordless': _install_deps_for_psycopg2() ext_file = None if is_url: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/profiles/_shared.py new/azure-cli-core-2.45.0/azure/cli/core/profiles/_shared.py --- old/azure-cli-core-2.44.1/azure/cli/core/profiles/_shared.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/profiles/_shared.py 2023-02-03 10:37:38.000000000 +0100 @@ -154,7 +154,7 @@ 'latest': { ResourceType.MGMT_STORAGE: '2022-09-01', ResourceType.MGMT_NETWORK: '2022-01-01', - ResourceType.MGMT_COMPUTE: SDKProfile('2022-08-01', { + ResourceType.MGMT_COMPUTE: SDKProfile('2022-11-01', { 'resource_skus': '2019-04-01', 'disks': '2022-07-02', 'disk_encryption_sets': '2022-03-02', @@ -166,7 +166,7 @@ 'gallery_applications': '2021-07-01', 'gallery_application_versions': '2022-01-03', 'shared_galleries': '2022-01-03', - 'virtual_machine_scale_sets': '2022-08-01', + 'virtual_machine_scale_sets': '2022-11-01', }), ResourceType.MGMT_RESOURCE_FEATURES: '2021-07-01', ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01', @@ -244,7 +244,7 @@ ResourceType.MGMT_IOTHUB: '2022-04-30-preview', ResourceType.MGMT_IOTDPS: '2021-10-15', ResourceType.MGMT_IOTCENTRAL: '2021-11-01-preview', - ResourceType.MGMT_ARO: '2022-04-01', + ResourceType.MGMT_ARO: '2022-09-04', ResourceType.MGMT_DATABOXEDGE: '2021-02-01-preview', ResourceType.MGMT_CUSTOMLOCATION: '2021-03-15-preview', ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2022-11-01', { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure/cli/core/util.py new/azure-cli-core-2.45.0/azure/cli/core/util.py --- old/azure-cli-core-2.44.1/azure/cli/core/util.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure/cli/core/util.py 2023-02-03 10:37:38.000000000 +0100 @@ -63,11 +63,6 @@ from requests.exceptions import SSLError, HTTPError from azure.cli.core import azclierror from msal_extensions.persistence import PersistenceError - import traceback - - logger.debug("azure.cli.core.util.handle_exception is called with an exception:") - # Print the traceback and exception message - logger.debug(traceback.format_exc()) error_msg = getattr(ex, 'message', str(ex)) exit_code = 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/azure_cli_core.egg-info/PKG-INFO new/azure-cli-core-2.45.0/azure_cli_core.egg-info/PKG-INFO --- old/azure-cli-core-2.44.1/azure_cli_core.egg-info/PKG-INFO 2023-01-10 16:46:38.000000000 +0100 +++ new/azure-cli-core-2.45.0/azure_cli_core.egg-info/PKG-INFO 2023-02-03 10:38:12.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: azure-cli-core -Version: 2.44.1 +Version: 2.45.0 Summary: Microsoft Azure Command-Line Tools Core Module Home-page: https://github.com/Azure/azure-cli Author: Microsoft Corporation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-core-2.44.1/setup.py new/azure-cli-core-2.45.0/setup.py --- old/azure-cli-core-2.44.1/setup.py 2023-01-10 16:46:13.000000000 +0100 +++ new/azure-cli-core-2.45.0/setup.py 2023-02-03 10:37:38.000000000 +0100 @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "2.44.1" +VERSION = "2.45.0" # If we have source, validate that our version numbers match # This should prevent uploading releases with mismatched versions.