def load_supported_images(cmd, prefix, namespace): # pylint: disable=unused-argument from msrest.exceptions import ClientRequestError from azure.batch.models import BatchErrorException from azure.cli.command_modules.batch._client_factory import account_client_factory all_images = [] client_creds = {} client_creds['account_name'] = cmd.cli_ctx.config.get('batch', 'account', None) client_creds['account_key'] = cmd.cli_ctx.config.get('batch', 'access_key', None) client_creds['account_endpoint'] = cmd.cli_ctx.config.get('batch', 'endpoint', None) try: client = account_client_factory(cmd.cli_ctx, client_creds) skus = client.list_supported_images() for sku in skus: all_images.append("{}:{}:{}:{}".format( sku.image_reference['publisher'], sku.image_reference['offer'], sku.image_reference['sku'], sku.image_reference['version'])) return all_images except (ClientRequestError, BatchErrorException): return []
def load_node_agent_skus(prefix, **kwargs): # pylint: disable=unused-argument from msrest.exceptions import ClientRequestError from azure.batch.models import BatchErrorException from azure.cli.command_modules.batch._client_factory import account_client_factory from azure.cli.core._config import az_config all_images = [] client_creds = {} client_creds['account_name'] = az_config.get('batch', 'account', None) client_creds['account_key'] = az_config.get('batch', 'access_key', None) client_creds['account_endpoint'] = az_config.get('batch', 'endpoint', None) try: client = account_client_factory(client_creds) skus = client.list_node_agent_skus() for sku in skus: for image in sku['verifiedImageReferences']: all_images.append("{}:{}:{}:{}".format(image['publisher'], image['offer'], image['sku'], image['version'])) return all_images except (ClientRequestError, BatchErrorException): return []
def load_node_agent_skus(cmd, prefix, namespace): # pylint: disable=unused-argument from msrest.exceptions import ClientRequestError from azure.batch.models import BatchErrorException from azure.cli.command_modules.batch._client_factory import account_client_factory all_images = [] client_creds = {} client_creds['account_name'] = cmd.cli_ctx.config.get('batch', 'account', None) client_creds['account_key'] = cmd.cli_ctx.config.get('batch', 'access_key', None) client_creds['account_endpoint'] = cmd.cli_ctx.config.get('batch', 'endpoint', None) try: client = account_client_factory(cmd.cli_ctx, client_creds) skus = client.list_node_agent_skus() for sku in skus: for image in sku['verifiedImageReferences']: all_images.append("{}:{}:{}:{}".format( image['publisher'], image['offer'], image['sku'], image['version'])) return all_images except (ClientRequestError, BatchErrorException): return []