Skip to content

Commit

Permalink
Upgrade the container/compute library to 0.32.0 (#1233)
Browse files Browse the repository at this point in the history
* Upgrade the container/compute library to 0.32.0

* fix CI

* address commments.

* addressed comment.
  • Loading branch information
brendandburns authored and yugangw-msft committed Nov 7, 2016
1 parent 8176229 commit eb316bc
Show file tree
Hide file tree
Showing 6 changed files with 466 additions and 923 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _get_acs_info(name, resource_group_name):
:type resource_group_name: String
"""
mgmt_client = get_mgmt_service_client(ComputeManagementClient)
return mgmt_client.container_service.get(resource_group_name, name)
return mgmt_client.container_services.get(resource_group_name, name)

def _rand_str(n):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-acs/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
]

DEPENDENCIES = [
'azure-mgmt-compute==0.30.0rc6',
'azure-mgmt-compute==0.32.0',
'paramiko',
'pyyaml',
'six',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
VirtualMachinesOperations,
VirtualMachineScaleSetsOperations,
VirtualMachineScaleSetVMsOperations,
ContainerServiceOperations)
ContainerServicesOperations)
from azure.mgmt.network.operations import NetworkInterfacesOperations
from azure.mgmt.network import NetworkManagementClient
from azure.cli.core.commands import DeploymentOutputLongRunningOperation, cli_command
Expand All @@ -30,6 +30,7 @@
from azure.cli.command_modules.vm.mgmt_acs.lib.operations import AcsOperations
from .custom import (
list_vm, resize_vm, list_vm_images, list_vm_extension_images, list_ip_addresses,
list_container_services,
attach_new_disk, attach_existing_disk, detach_disk, list_disks, capture_vm, get_instance_view,
vm_update_nics, vm_delete_nics, vm_add_nics, vm_open_port,
reset_windows_admin, set_linux_user, delete_linux_user,
Expand Down Expand Up @@ -110,19 +111,19 @@ def get_vm_client_with_shorter_polling_interval(_):
factory = lambda _: get_mgmt_service_client(ACSClient).acs
cli_command('acs create', AcsOperations.create_or_update, factory, transform=DeploymentOutputLongRunningOperation('Starting container service create'))

factory = lambda _: _compute_client_factory().container_service
factory = lambda _: _compute_client_factory().container_services
#Remove the hack after https://github.com/Azure/azure-rest-api-specs/issues/352 fixed
from azure.mgmt.compute.models import ContainerService#pylint: disable=wrong-import-position
for a in ['id', 'name', 'type', 'location']:
ContainerService._attribute_map[a]['type'] = 'str'#pylint: disable=protected-access
ContainerService._attribute_map['tags']['type'] = '{str}'#pylint: disable=protected-access
######
cli_command('acs show', ContainerServiceOperations.get, factory)
cli_command('acs list', ContainerServiceOperations.list, factory)
cli_command('acs delete', ContainerServiceOperations.delete, factory)
cli_command('acs show', ContainerServicesOperations.get, factory)
cli_command('acs list', list_container_services, factory)
cli_command('acs delete', ContainerServicesOperations.delete, factory)
cli_command('acs scale', update_acs)
#Per conversation with ACS team, hide the update till we have something meaningful to tweak
#cli_generic_update_command('acs update', ContainerServiceOperations.get, ContainerServiceOperations.create_or_update, factory)
#cli_generic_update_command('acs update', ContainerServicesOperations.get, ContainerServiceOperations.create_or_update, factory)

# VM Diagnostics
cli_command('vm diagnostics set', set_diagnostics_extension)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1015,8 +1015,13 @@ def vmss_set(**kwargs):

def update_acs(resource_group_name, container_service_name, new_agent_count):
client = _compute_client_factory()
instance = client.container_service.get(resource_group_name, container_service_name)
instance = client.container_services.get(resource_group_name, container_service_name)
instance.agent_pool_profiles[0].count = new_agent_count
return client.container_service.create_or_update(resource_group_name,
container_service_name, instance)

return client.container_services.create_or_update(resource_group_name,
container_service_name, instance)

def list_container_services(client, resource_group_name=None):
''' List Container Services. '''
svc_list = client.list_by_resource_group(resource_group_name=resource_group_name) \
if resource_group_name else client.list()
return list(svc_list)
Loading

0 comments on commit eb316bc

Please sign in to comment.