Hello community,
here is the log from the commit of package azure-cli-container for
openSUSE:Factory checked in at 2018-02-14 09:30:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/azure-cli-container (Old)
and /work/SRC/openSUSE:Factory/.azure-cli-container.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "azure-cli-container"
Wed Feb 14 09:30:28 2018 rev:2 rq:574804 version:0.1.16
Changes:
--------
--- /work/SRC/openSUSE:Factory/azure-cli-container/azure-cli-container.changes
2017-11-10 14:53:22.576804238 +0100
+++
/work/SRC/openSUSE:Factory/.azure-cli-container.new/azure-cli-container.changes
2018-02-14 09:30:29.189948795 +0100
@@ -1,0 +2,10 @@
+Wed Feb 7 15:51:57 UTC 2018 - [email protected]
+
+- New upstream release
+ + Version 0.1.16
+ + For detailed information about changes see the
+ HISTORY.rst file provided with this package
+- Install HISTORY.rst into doc directory
+- Update Requires from setup.py
+
+-------------------------------------------------------------------
Old:
----
azure-cli-container-0.1.11.tar.gz
New:
----
azure-cli-container-0.1.16.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ azure-cli-container.spec ++++++
--- /var/tmp/diff_new_pack.fXPZuM/_old 2018-02-14 09:30:31.209875600 +0100
+++ /var/tmp/diff_new_pack.fXPZuM/_new 2018-02-14 09:30:31.213875455 +0100
@@ -1,7 +1,7 @@
#
# spec file for package azure-cli-container
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -15,8 +15,9 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
+
Name: azure-cli-container
-Version: 0.1.11
+Version: 0.1.16
Release: 0
Summary: Microsoft Azure CLI 'container' Command Module
License: MIT
@@ -24,18 +25,18 @@
Url: https://github.com/Azure/azure-cli
Source:
https://files.pythonhosted.org/packages/source/a/azure-cli-container/azure-cli-container-%{version}.tar.gz
Source1: LICENSE.txt
-BuildRequires: python3-devel
-BuildRequires: python3-setuptools
-BuildRequires: unzip
BuildRequires: azure-cli-command-modules-nspkg
BuildRequires: azure-cli-nspkg
BuildRequires: python3-azure-nspkg
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: unzip
Requires: azure-cli-command-modules-nspkg
-Requires: azure-cli-nspkg
-Requires: python3-azure-nspkg
-Requires: python3-azure-mgmt-containerinstance
Requires: azure-cli-core
+Requires: azure-cli-nspkg
Requires: python3-PyYAML
+Requires: python3-azure-mgmt-containerinstance >= 0.2.0
+Requires: python3-azure-nspkg
Conflicts: azure-cli < 2.0.0
BuildArch: noarch
@@ -64,7 +65,8 @@
%files
%defattr(-,root,root,-)
-%doc LICENSE.txt README.rst
+%doc HISTORY.rst LICENSE.txt README.rst
%{python3_sitelib}/azure/cli/command_modules/container
%{python3_sitelib}/azure_cli_container-*.egg-info
+
%changelog
++++++ azure-cli-container-0.1.11.tar.gz -> azure-cli-container-0.1.16.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-container-0.1.11/HISTORY.rst
new/azure-cli-container-0.1.16/HISTORY.rst
--- old/azure-cli-container-0.1.11/HISTORY.rst 2017-09-23 01:47:00.000000000
+0200
+++ new/azure-cli-container-0.1.16/HISTORY.rst 2018-01-05 22:11:35.000000000
+0100
@@ -2,6 +2,31 @@
Release History
===============
+
+0.1.16
+++++++
+* Update for CLI core changes.
+
+0.1.15
+++++++
+* Fix incorrect order of parameters for container logs
+
+0.1.14
+++++++
+* Fixed default ports regression
+
+0.1.13
+++++++
+* minor fixes
+* Added support to open multiple ports
+* Added container group restart policy
+* Added support to mount Azure File share as a volume
+* Updated helper docs
+
+0.1.12
+++++++
+* minor fixes
+
0.1.11 (2017-09-22)
+++++++++++++++++++
* minor fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-container-0.1.11/PKG-INFO
new/azure-cli-container-0.1.16/PKG-INFO
--- old/azure-cli-container-0.1.11/PKG-INFO 2017-09-23 01:47:46.000000000
+0200
+++ new/azure-cli-container-0.1.16/PKG-INFO 2018-01-05 22:11:53.000000000
+0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: azure-cli-container
-Version: 0.1.11
+Version: 0.1.16
Summary: Microsoft Azure Command-Line Tools container Command Module
Home-page: https://github.com/Azure/azure-cli
Author: Microsoft Corporation
@@ -192,6 +192,31 @@
Release History
===============
+
+ 0.1.16
+ ++++++
+ * Update for CLI core changes.
+
+ 0.1.15
+ ++++++
+ * Fix incorrect order of parameters for container logs
+
+ 0.1.14
+ ++++++
+ * Fixed default ports regression
+
+ 0.1.13
+ ++++++
+ * minor fixes
+ * Added support to open multiple ports
+ * Added container group restart policy
+ * Added support to mount Azure File share as a volume
+ * Updated helper docs
+
+ 0.1.12
+ ++++++
+ * minor fixes
+
0.1.11 (2017-09-22)
+++++++++++++++++++
* minor fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/__init__.py
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/__init__.py
---
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/__init__.py
2017-09-23 01:47:00.000000000 +0200
+++
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/__init__.py
2018-01-05 22:11:35.000000000 +0100
@@ -3,12 +3,28 @@
# Licensed under the MIT License. See License.txt in the project root for
license information.
#
--------------------------------------------------------------------------------------------
+from azure.cli.core import AzCommandsLoader
+
import azure.cli.command_modules.container._help # pylint:
disable=unused-import
-def load_params(_):
- import azure.cli.command_modules.container._params # pylint:
disable=redefined-outer-name, unused-variable
+class ContainerCommandsLoader(AzCommandsLoader):
+
+ def __init__(self, cli_ctx=None):
+ from azure.cli.core.commands import CliCommandType
+ custom_type =
CliCommandType(operations_tmpl='azure.cli.command_modules.container.custom#{}')
+ super(ContainerCommandsLoader, self).__init__(cli_ctx=cli_ctx,
+
custom_command_type=custom_type,
+
min_profile='2017-03-10-profile')
+
+ def load_command_table(self, args):
+ from azure.cli.command_modules.container.commands import
load_command_table
+ load_command_table(self, args)
+ return self.command_table
+
+ def load_arguments(self, command):
+ from azure.cli.command_modules.container._params import load_arguments
+ load_arguments(self, command)
-def load_commands():
- import azure.cli.command_modules.container.commands # pylint:
disable=redefined-outer-name, unused-variable
+COMMAND_LOADER_CLS = ContainerCommandsLoader
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_client_factory.py
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_client_factory.py
---
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_client_factory.py
2017-09-23 01:47:00.000000000 +0200
+++
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_client_factory.py
2018-01-05 22:11:35.000000000 +0100
@@ -4,7 +4,15 @@
#
--------------------------------------------------------------------------------------------
-def _container_instance_client_factory(_):
+def _container_instance_client_factory(cli_ctx, *_):
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
from azure.cli.core.commands.client_factory import get_mgmt_service_client
- return get_mgmt_service_client(ContainerInstanceManagementClient)
+ return get_mgmt_service_client(cli_ctx, ContainerInstanceManagementClient)
+
+
+def cf_container_groups(cli_ctx, *_):
+ return _container_instance_client_factory(cli_ctx).container_groups
+
+
+def cf_container_logs(cli_ctx, *_):
+ return _container_instance_client_factory(cli_ctx).container_logs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_format.py
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_format.py
---
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_format.py
1970-01-01 01:00:00.000000000 +0100
+++
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_format.py
2018-01-05 22:11:35.000000000 +0100
@@ -0,0 +1,66 @@
+#
--------------------------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
license information.
+#
--------------------------------------------------------------------------------------------
+
+from __future__ import print_function
+from collections import OrderedDict
+
+
+def _get_images(container_group):
+ """Get all images of a container group. """
+ containers = container_group.get('containers')
+ if containers is not None and containers:
+ images = set([])
+ for container in containers:
+ images.add(container['image'])
+ return ','.join(images)
+ return None
+
+
+def _format_cpu_memory(container_group):
+ """Format CPU and memory. """
+ containers = container_group.get('containers')
+ if containers is not None and containers:
+ total_cpu = 0
+ total_memory = 0
+ for container in containers:
+ resources = container.get('resources')
+ if resources is not None:
+ resources_requests = resources.get('requests')
+ if resources_requests is not None:
+ total_cpu += resources_requests.get('cpu', 0)
+ total_memory += resources_requests.get('memoryInGb', 0)
+ return '{0} core/{1} gb'.format(total_cpu, total_memory)
+ return None
+
+
+def _format_ip_address(container_group):
+ """Format IP address. """
+ ip_address = container_group.get('ipAddress')
+ if ip_address is not None:
+ ports = ','.join(str(p['port']) for p in ip_address['ports'])
+ return '{0}:{1}'.format(ip_address.get('ip'), ports)
+ return None
+
+
+def transform_log_output(result):
+ '''Print log. '''
+ print(result)
+
+
+def transform_container_group(result):
+ """Transform a container group to table output. """
+ return OrderedDict([('Name', result['name']),
+ ('ResourceGroup', result['resourceGroup']),
+ ('ProvisioningState', result.get('provisioningState')),
+ ('Image', _get_images(result)),
+ ('IP:ports', _format_ip_address(result)),
+ ('CPU/Memory', _format_cpu_memory(result)),
+ ('OsType', result.get('osType')),
+ ('Location', result['location'])])
+
+
+def transform_container_group_list(result):
+ """Transform a container group list to table output. """
+ return [transform_container_group(container_group) for container_group in
result]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_help.py
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_help.py
--- old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_help.py
2017-09-23 01:47:00.000000000 +0200
+++ new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_help.py
2018-01-05 22:11:35.000000000 +0100
@@ -3,7 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for
license information.
#
--------------------------------------------------------------------------------------------
-from azure.cli.core.help_files import helps
+from knack.help_files import helps # pylint: disable=unused-import
+
helps['container'] = """
type: group
@@ -14,20 +15,24 @@
type: command
short-summary: Create a container group.
examples:
- - name: Create a container group with 1 core and 1Gb of memory.
+ - name: Create a container in a container group with 1 core and 1Gb of
memory.
text: az container create -g MyResourceGroup --name myalpine --image
alpine:latest --cpu 1 --memory 1
- - name: Create a container group that runs Windows, with 2 cores and
3.5Gb of memory.
+ - name: Create a container in a container group that runs Windows,
with 2 cores and 3.5Gb of memory.
text: az container create -g MyResourceGroup --name mywinapp --image
winappimage:latest --os-type Windows --cpu 2 --memory 3.5
- - name: Create a container group with public IP address.
- text: az container create -g MyResourceGroup --name myalpine --image
alpine:latest --ip-address public
- - name: Create a container group that invokes a script upon start.
+ - name: Create a container in a container group with public IP address
and ports.
+ text: az container create -g MyResourceGroup --name myalpine --image
alpine:latest --ip-address public --ports 80 443
+ - name: Create a container in a container group that invokes a script
upon start.
text: az container create -g MyResourceGroup --name myalpine --image
alpine:latest --command-line "/bin/sh -c '/path to/myscript.sh'"
- - name: Create a container group with environment variables.
+ - name: Create a container in a container group that runs a command
and stop the container afterwards.
+ text: az container create -g MyResourceGroup --name myalpine --image
alpine:latest --command-line "echo hello" --restart-policy Never
+ - name: Create a container in a container group with environment
variables.
text: az container create -g MyResourceGroup --name myalpine --image
alpine:latest -e key1=value1 key2=value2
- - name: Create a container group using container image from Azure
Container Registry.
+ - name: Create a container in a container group using container image
from Azure Container Registry.
text: az container create -g MyResourceGroup --name myalpine --image
myAcrRegistry.azurecr.io/alpine:latest --registry-password password
- - name: Create a container group using container image from another
private container image registry.
+ - name: Create a container in a container group using container image
from another private container image registry.
text: az container create -g MyResourceGroup --name myapp --image
myimage:latest --cpu 1 --memory 1.5 --registry-login-server myregistry.com
--registry-username username --registry-password password
+ - name: Create a container in a container group that mounts an Azure
File share as volume.
+ text: az container create -g MyResourceGroup --name myapp --image
alpine:latest --command-line "cat /mnt/azfile/myfile"
--azure-file-volume-share-name myshare --azure-file-volume-account-name
mystorageaccount --azure-file-volume-account-key mystoragekey
--azure-file-volume-mount-path /mnt/azfile
"""
helps['container delete'] = """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_params.py
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_params.py
---
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_params.py
2017-09-23 01:47:00.000000000 +0200
+++
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_params.py
2018-01-05 22:11:35.000000000 +0100
@@ -3,21 +3,20 @@
# Licensed under the MIT License. See License.txt in the project root for
license information.
#
--------------------------------------------------------------------------------------------
-from azure.cli.core.commands import register_cli_argument
-from azure.cli.core.commands.parameters import (enum_choice_list,
- location_type,
+from knack.util import CLIError
+from azure.cli.core.commands.parameters import (get_enum_type,
+ get_location_type,
resource_group_name_type)
from azure.cli.core.commands.validators import
get_default_location_from_resource_group
-from azure.cli.core.util import CLIError
-import azure.cli.core.commands.arm # pylint: disable=unused-import
+from azure.mgmt.containerinstance.models import (ContainerGroupRestartPolicy,
OperatingSystemTypes)
+from ._validators import validate_volume_mount_path
# pylint: disable=line-too-long
IP_ADDRESS_TYPES = ['Public']
-OS_TYPES = ['Windows', 'Linux']
-def environment_variables_format(value):
+def _environment_variables_type(value):
"""Space separated values in 'key=value' format."""
try:
env_name, env_value = value.split('=', 1)
@@ -28,20 +27,34 @@
return {'name': env_name, 'value': env_value}
-register_cli_argument('container', 'resource_group_name',
resource_group_name_type)
-register_cli_argument('container', 'name', options_list=('--name', '-n'),
help="The name of the container group", id_part='name')
-register_cli_argument('container', 'location', location_type)
-
-register_cli_argument('container create', 'location', location_type,
validator=get_default_location_from_resource_group)
-register_cli_argument('container create', 'image', help='The container image
name')
-register_cli_argument('container create', 'cpu', type=int, help='The required
number of CPU cores of the containers')
-register_cli_argument('container create', 'memory', type=float, help='The
required memory of the containers in GB')
-register_cli_argument('container create', 'os_type', help='The OS type of the
containers', **enum_choice_list(OS_TYPES))
-register_cli_argument('container create', 'ip_address', help='The IP address
type of the container group', **enum_choice_list(IP_ADDRESS_TYPES))
-register_cli_argument('container create', 'command_line', help='The command
line to run when the container is started, e.g. \'/bin/bash -c myscript.sh\'')
-register_cli_argument('container create', 'environment_variables', nargs='+',
options_list=('--environment-variables', '-e'),
type=environment_variables_format, help='A list of environment variable for the
container. Space separated values in \'key=value\' format.')
-register_cli_argument('container create', 'registry_login_server',
arg_group='Image Registry', help='The container image registry login server')
-register_cli_argument('container create', 'registry_username',
arg_group='Image Registry', help='The username to log in container image
registry server')
-register_cli_argument('container create', 'registry_password',
arg_group='Image Registry', help='The password to log in container image
registry server')
+def load_arguments(self, _):
+ with self.argument_context('container') as c:
+ c.argument('resource_group_name', arg_type=resource_group_name_type)
+ c.argument('name', options_list=['--name', '-n'], help="The name of
the container group", id_part='name')
+ c.argument('location', arg_type=get_location_type(self.cli_ctx))
+
+ with self.argument_context('container create') as c:
+ c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
+ c.argument('image', help='The container image name')
+ c.argument('cpu', type=int, help='The required number of CPU cores of
the containers')
+ c.argument('memory', type=float, help='The required memory of the
containers in GB')
+ c.argument('os_type', arg_type=get_enum_type(OperatingSystemTypes),
help='The OS type of the containers')
+ c.argument('ip_address', arg_type=get_enum_type(IP_ADDRESS_TYPES),
help='The IP address type of the container group')
+ c.argument('ports', type=int, nargs='+', default=[80], help='The ports
to open')
+ c.argument('restart_policy',
arg_type=get_enum_type(ContainerGroupRestartPolicy), help='Restart policy for
all containers within the container group')
+ c.argument('command_line', help='The command line to run when the
container is started, e.g. \'/bin/bash -c myscript.sh\'')
+ c.argument('environment_variables', nargs='+',
options_list=['--environment-variables', '-e'],
type=_environment_variables_type, help='A list of environment variable for the
container. Space separated values in \'key=value\' format.')
+
+ with self.argument_context('container create', arg_group='Image Registry')
as c:
+ c.argument('registry_login_server', help='The container image registry
login server')
+ c.argument('registry_username', help='The username to log in container
image registry server')
+ c.argument('registry_password', help='The password to log in container
image registry server')
+
+ with self.argument_context('container create', arg_group='Azure File
Volume') as c:
+ c.argument('azure_file_volume_share_name', help='The name of the Azure
File share to be mounted as a volume')
+ c.argument('azure_file_volume_account_name', help='The name of the
storage account that contains the Azure File share')
+ c.argument('azure_file_volume_account_key', help='The storage account
access key used to access the Azure File share')
+ c.argument('azure_file_volume_mount_path',
validator=validate_volume_mount_path, help='The path within the container where
the volume should be mounted. Must not contain colon (:).')
-register_cli_argument('container logs', 'container_name', help='The container
name to tail the logs')
+ with self.argument_context('container logs') as c:
+ c.argument('container_name', help='The container name to tail the
logs')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_validators.py
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_validators.py
---
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/_validators.py
1970-01-01 01:00:00.000000000 +0100
+++
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/_validators.py
2018-01-05 22:11:35.000000000 +0100
@@ -0,0 +1,11 @@
+#
--------------------------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
license information.
+#
--------------------------------------------------------------------------------------------
+
+from knack.util import CLIError
+
+
+def validate_volume_mount_path(ns):
+ if ns.azure_file_volume_mount_path and ':' in
ns.azure_file_volume_mount_path:
+ raise CLIError("The Azure File volume mount path cannot container ':'")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/commands.py
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/commands.py
---
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/commands.py
2017-09-23 01:47:00.000000000 +0200
+++
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/commands.py
2018-01-05 22:11:35.000000000 +0100
@@ -3,73 +3,16 @@
# Licensed under the MIT License. See License.txt in the project root for
license information.
#
--------------------------------------------------------------------------------------------
-# pylint: disable=line-too-long
-
-from __future__ import print_function
-from collections import OrderedDict
-from azure.cli.core.commands import cli_command
-from azure.cli.core.profiles import supported_api_version, PROFILE_TYPE
from azure.cli.core.util import empty_on_404
-from ._client_factory import _container_instance_client_factory
-
-if not supported_api_version(PROFILE_TYPE, max_api='2017-03-09-profile'):
- custom_path = 'azure.cli.command_modules.container.custom#{}'
-
- def transform_log_output(result):
- '''Print log. '''
- print(result)
-
- def transform_container_group(result):
- """Transform a container group to table output. """
- return OrderedDict([('Name', result['name']),
- ('ResourceGroup', result['resourceGroup']),
- ('ProvisioningState',
result.get('provisioningState')),
- ('Image', get_images(result)),
- ('IP:ports', format_ip_address(result)),
- ('CPU/Memory', format_cpu_memory(result)),
- ('OsType', result.get('osType')),
- ('Location', result['location'])])
-
- def get_images(container_group):
- """Get all images of a container group. """
- containers = container_group.get('containers')
- if containers is not None and containers:
- images = set([])
- for container in containers:
- images.add(container['image'])
- return ','.join(images)
- return None
-
- def format_cpu_memory(container_group):
- """Format CPU and memory. """
- containers = container_group.get('containers')
- if containers is not None and containers:
- total_cpu = 0
- total_memory = 0
- for container in containers:
- resources = container.get('resources')
- if resources is not None:
- resources_requests = resources.get('requests')
- if resources_requests is not None:
- total_cpu += resources_requests.get('cpu', 0)
- total_memory += resources_requests.get('memoryInGb', 0)
- return '{0} core/{1} gb'.format(total_cpu, total_memory)
- return None
-
- def format_ip_address(container_group):
- """Format IP address. """
- ip_address = container_group.get('ipAddress')
- if ip_address is not None:
- ports = ','.join(str(p['port']) for p in ip_address['ports'])
- return '{0}:{1}'.format(ip_address.get('ip'), ports)
- return None
+from ._client_factory import cf_container_groups, cf_container_logs
+from ._format import transform_log_output, transform_container_group_list,
transform_container_group
- def transform_container_group_list(result):
- """Transform a container group list to table output. """
- return [transform_container_group(container_group) for container_group
in result]
- cli_command(__name__, 'container list',
custom_path.format('list_containers'), _container_instance_client_factory,
table_transformer=transform_container_group_list)
- cli_command(__name__, 'container create',
custom_path.format('create_container'), _container_instance_client_factory,
table_transformer=transform_container_group_list)
- cli_command(__name__, 'container show',
custom_path.format('get_container'), _container_instance_client_factory,
exception_handler=empty_on_404, table_transformer=transform_container_group)
- cli_command(__name__, 'container delete',
custom_path.format('delete_container'), _container_instance_client_factory,
confirmation=True)
- cli_command(__name__, 'container logs',
custom_path.format('container_logs'), _container_instance_client_factory,
transform=transform_log_output)
+def load_command_table(self, _):
+ with self.command_group('container', client_factory=cf_container_groups)
as g:
+ g.custom_command('list', 'list_containers',
table_transformer=transform_container_group_list)
+ g.custom_command('create', 'create_container',
table_transformer=transform_container_group_list)
+ g.custom_command('show', 'get_container',
exception_handler=empty_on_404,
+ table_transformer=transform_container_group)
+ g.custom_command('delete', 'delete_container', confirmation=True)
+ g.custom_command('logs', 'container_logs',
client_factory=cf_container_logs, transform=transform_log_output)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/custom.py
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/custom.py
---
old/azure-cli-container-0.1.11/azure/cli/command_modules/container/custom.py
2017-09-23 01:47:00.000000000 +0200
+++
new/azure-cli-container-0.1.16/azure/cli/command_modules/container/custom.py
2018-01-05 22:11:35.000000000 +0100
@@ -6,31 +6,32 @@
# pylint:
disable=too-few-public-methods,too-many-arguments,no-self-use,too-many-locals,line-too-long,unused-argument
import shlex
-from azure.cli.core.prompting import prompt_pass, NoTTYException
-from azure.cli.core.util import CLIError
+from knack.prompting import prompt_pass, NoTTYException
+from knack.util import CLIError
from azure.mgmt.containerinstance.models import (ContainerGroup, Container,
ContainerPort, Port, IpAddress,
ImageRegistryCredential,
ResourceRequirements, ResourceRequests,
-
ContainerGroupNetworkProtocol, OperatingSystemTypes)
+
ContainerGroupNetworkProtocol, Volume, AzureFileVolume, VolumeMount)
-ACR_SERVER_SUFFIX = ".azurecr.io/"
+ACR_SERVER_SUFFIX = '.azurecr.io/'
+AZURE_FILE_VOLUME_NAME = 'azurefile'
def list_containers(client, resource_group_name=None):
"""List all container groups in a resource group. """
if resource_group_name is None:
- return client.container_groups.list()
- return client.container_groups.list_by_resource_group(resource_group_name)
+ return client.list()
+ return client.list_by_resource_group(resource_group_name)
def get_container(client, resource_group_name, name):
"""Show details of a container group. """
- return client.container_groups.get(resource_group_name, name)
+ return client.get(resource_group_name, name)
def delete_container(client, resource_group_name, name, **kwargs):
"""Delete a container group. """
- return client.container_groups.delete(resource_group_name, name)
+ return client.delete(resource_group_name, name)
def create_container(client,
@@ -40,81 +41,140 @@
location=None,
cpu=1,
memory=1.5,
- port=80,
+ restart_policy='Always',
+ ports=None,
os_type='Linux',
ip_address=None,
command_line=None,
environment_variables=None,
registry_login_server=None,
registry_username=None,
- registry_password=None):
- """"Create a container group. """
+ registry_password=None,
+ azure_file_volume_share_name=None,
+ azure_file_volume_account_name=None,
+ azure_file_volume_account_key=None,
+ azure_file_volume_mount_path=None):
+ """Create a container group. """
- container_resource_requirements = None
- if cpu is not None or memory is not None:
+ ports = ports or [80]
+
+ container_resource_requirements = create_resource_requirements(cpu=cpu,
memory=memory)
+
+ image_registry_credentials =
create_image_registry_credentials(registry_login_server=registry_login_server,
+
registry_username=registry_username,
+
registry_password=registry_password,
+ image=image)
+
+ command = shlex.split(command_line) if command_line else None
+
+ azure_file_volume =
create_azure_file_volume(azure_file_volume_share_name=azure_file_volume_share_name,
+
azure_file_volume_account_name=azure_file_volume_account_name,
+
azure_file_volume_account_key=azure_file_volume_account_key)
+
+ azure_file_volume_mount =
create_azure_file_volume_mount(azure_file_volume=azure_file_volume,
+
azure_file_volume_mount_path=azure_file_volume_mount_path)
+
+ cgroup_ip_address = create_ip_address(ip_address, ports)
+
+ container = Container(name=name,
+ image=image,
+ resources=container_resource_requirements,
+ command=command,
+ ports=[ContainerPort(port=p) for p in ports] if
cgroup_ip_address else None,
+ environment_variables=environment_variables,
+ volume_mounts=azure_file_volume_mount)
+
+ cgroup = ContainerGroup(location=location,
+ containers=[container],
+ os_type=os_type,
+ restart_policy=restart_policy,
+ ip_address=cgroup_ip_address,
+
image_registry_credentials=image_registry_credentials,
+ volumes=azure_file_volume)
+
+ return client.create_or_update(resource_group_name, name, cgroup)
+
+
+# pylint: disable=inconsistent-return-statements
+def create_resource_requirements(cpu, memory):
+ """Create resource requirements. """
+ if cpu or memory:
container_resource_requests = ResourceRequests(memory_in_gb=memory,
cpu=cpu)
- container_resource_requirements =
ResourceRequirements(requests=container_resource_requests)
+ return ResourceRequirements(requests=container_resource_requests)
+
+def create_image_registry_credentials(registry_login_server,
registry_username, registry_password, image):
+ """Create image registry credentials. """
image_registry_credentials = None
- if registry_login_server is not None:
- if registry_username is None:
- try:
- registry_username = prompt_pass(msg='Image registry username:
')
- except NoTTYException:
- raise CLIError('Please specify --username in non-interactive
mode.')
- if registry_password is None:
+ if registry_login_server:
+ if not registry_username:
+ raise CLIError('Please specify --registry-username in order to use
custom image registry.')
+ if not registry_password:
try:
registry_password = prompt_pass(msg='Image registry password:
')
except NoTTYException:
- raise CLIError('Please specify --registry-password in
non-interactive mode.')
+ raise CLIError('Please specify --registry-password in order to
use custom image registry.')
image_registry_credentials =
[ImageRegistryCredential(server=registry_login_server,
username=registry_username,
password=registry_password)]
elif ACR_SERVER_SUFFIX in image:
- if registry_password is None:
+ if not registry_password:
try:
registry_password = prompt_pass(msg='Image registry password:
')
except NoTTYException:
- raise CLIError('Please specify --registry-password in
non-interactive mode.')
+ raise CLIError('Please specify --registry-password in order to
use Azure Container Registry.')
acr_server = image.split("/")[0] if image.split("/") else None
acr_username = image.split(ACR_SERVER_SUFFIX)[0] if
image.split(ACR_SERVER_SUFFIX) else None
- if acr_server is not None and acr_username is not None:
+ if acr_server and acr_username:
image_registry_credentials =
[ImageRegistryCredential(server=acr_server,
username=acr_username,
password=registry_password)]
else:
raise CLIError('Failed to parse ACR server or username from image
name; please explicitly specify --registry-server and --registry-username.')
- command = None
- if command_line is not None:
- command = shlex.split(command_line)
-
- container = Container(name=name,
- image=image,
- resources=container_resource_requirements,
- command=command,
- ports=[ContainerPort(port=port)],
- environment_variables=environment_variables)
-
- cgroup_ip_address = None
- if ip_address is not None and ip_address.lower() == 'public':
- cgroup_ip_address =
IpAddress(ports=[Port(protocol=ContainerGroupNetworkProtocol.tcp, port=port)])
+ return image_registry_credentials
- cgroup_os_type = OperatingSystemTypes.linux if os_type.lower() == "linux"
else OperatingSystemTypes.windows
- cgroup = ContainerGroup(location=location,
- containers=[container],
- os_type=cgroup_os_type,
- ip_address=cgroup_ip_address,
-
image_registry_credentials=image_registry_credentials)
+def create_azure_file_volume(azure_file_volume_share_name,
azure_file_volume_account_name, azure_file_volume_account_key):
+ """Create Azure File volume. """
+ azure_file_volume = None
+ if azure_file_volume_share_name:
+ if not azure_file_volume_account_name:
+ raise CLIError('Please specify --azure-file-volume-account-name in
order to use Azure File volume.')
+ if not azure_file_volume_account_key:
+ try:
+ azure_file_volume_account_key = prompt_pass(msg='Azure File
storage account key: ')
+ except NoTTYException:
+ raise CLIError('Please specify --azure-file-volume-account-key
in order to use Azure File volume.')
- return client.container_groups.create_or_update(resource_group_name, name,
cgroup)
+ azure_file_volume =
AzureFileVolume(share_name=azure_file_volume_share_name,
+
storage_account_name=azure_file_volume_account_name,
+
storage_account_key=azure_file_volume_account_key)
+
+ return [Volume(name=AZURE_FILE_VOLUME_NAME, azure_file=azure_file_volume)]
if azure_file_volume else None
+
+
+# pylint: disable=inconsistent-return-statements
+def create_azure_file_volume_mount(azure_file_volume,
azure_file_volume_mount_path):
+ """Create Azure File volume mount. """
+ if azure_file_volume_mount_path:
+ if not azure_file_volume:
+ raise CLIError('Please specify --azure-file-volume-share-name
--azure-file-volume-account-name --azure-file-volume-account-key '
+ 'to enable Azure File volume mount.')
+ return [VolumeMount(name=AZURE_FILE_VOLUME_NAME,
mount_path=azure_file_volume_mount_path)]
+
+
+# pylint: disable=inconsistent-return-statements
+def create_ip_address(ip_address, ports):
+ """Create IP address. """
+ if ip_address and ip_address.lower() == 'public':
+ return
IpAddress(ports=[Port(protocol=ContainerGroupNetworkProtocol.tcp, port=p) for p
in ports])
def container_logs(client, resource_group_name, name, container_name=None):
"""Tail a container instance log. """
if container_name is None:
container_name = name
- log = client.container_logs.list(resource_group_name, container_name, name)
+ log = client.list(resource_group_name, name, container_name)
return log.content
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure_cli_container.egg-info/PKG-INFO
new/azure-cli-container-0.1.16/azure_cli_container.egg-info/PKG-INFO
--- old/azure-cli-container-0.1.11/azure_cli_container.egg-info/PKG-INFO
2017-09-23 01:47:46.000000000 +0200
+++ new/azure-cli-container-0.1.16/azure_cli_container.egg-info/PKG-INFO
2018-01-05 22:11:53.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: azure-cli-container
-Version: 0.1.11
+Version: 0.1.16
Summary: Microsoft Azure Command-Line Tools container Command Module
Home-page: https://github.com/Azure/azure-cli
Author: Microsoft Corporation
@@ -192,6 +192,31 @@
Release History
===============
+
+ 0.1.16
+ ++++++
+ * Update for CLI core changes.
+
+ 0.1.15
+ ++++++
+ * Fix incorrect order of parameters for container logs
+
+ 0.1.14
+ ++++++
+ * Fixed default ports regression
+
+ 0.1.13
+ ++++++
+ * minor fixes
+ * Added support to open multiple ports
+ * Added container group restart policy
+ * Added support to mount Azure File share as a volume
+ * Updated helper docs
+
+ 0.1.12
+ ++++++
+ * minor fixes
+
0.1.11 (2017-09-22)
+++++++++++++++++++
* minor fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure_cli_container.egg-info/SOURCES.txt
new/azure-cli-container-0.1.16/azure_cli_container.egg-info/SOURCES.txt
--- old/azure-cli-container-0.1.11/azure_cli_container.egg-info/SOURCES.txt
2017-09-23 01:47:46.000000000 +0200
+++ new/azure-cli-container-0.1.16/azure_cli_container.egg-info/SOURCES.txt
2018-01-05 22:11:53.000000000 +0100
@@ -8,8 +8,10 @@
azure/cli/command_modules/__init__.py
azure/cli/command_modules/container/__init__.py
azure/cli/command_modules/container/_client_factory.py
+azure/cli/command_modules/container/_format.py
azure/cli/command_modules/container/_help.py
azure/cli/command_modules/container/_params.py
+azure/cli/command_modules/container/_validators.py
azure/cli/command_modules/container/commands.py
azure/cli/command_modules/container/custom.py
azure_cli_container.egg-info/PKG-INFO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-container-0.1.11/azure_cli_container.egg-info/requires.txt
new/azure-cli-container-0.1.16/azure_cli_container.egg-info/requires.txt
--- old/azure-cli-container-0.1.11/azure_cli_container.egg-info/requires.txt
2017-09-23 01:47:46.000000000 +0200
+++ new/azure-cli-container-0.1.16/azure_cli_container.egg-info/requires.txt
2018-01-05 22:11:53.000000000 +0100
@@ -1,4 +1,3 @@
-azure-mgmt-containerinstance
+azure-mgmt-containerinstance==0.2.0
azure-cli-core
pyyaml
-azure-cli-command-modules-nspkg>=2.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-container-0.1.11/setup.py
new/azure-cli-container-0.1.16/setup.py
--- old/azure-cli-container-0.1.11/setup.py 2017-09-23 01:47:45.000000000
+0200
+++ new/azure-cli-container-0.1.16/setup.py 2018-01-05 22:11:35.000000000
+0100
@@ -14,7 +14,7 @@
logger.warn("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}
-VERSION = "0.1.11"
+VERSION = "0.1.16"
CLASSIFIERS = [
'Development Status :: 4 - Beta',
@@ -31,7 +31,7 @@
]
DEPENDENCIES = [
- 'azure-mgmt-containerinstance',
+ 'azure-mgmt-containerinstance==0.2.0',
'azure-cli-core',
'pyyaml',
]