def test_browse_dcos(self, get_subscription_id): acs_info = ContainerService("location", {}, {}, {}) acs_info.orchestrator_profile = ContainerServiceOrchestratorProfile( ContainerServiceOrchestratorTypes.dcos) with mock.patch( 'azure.cli.command_modules.acs.custom._dcos_browse_internal') as dcos_browse: _acs_browse_internal(acs_info, 'resource-group', 'name', False, 'ssh/key/file') dcos_browse.assert_called_with(acs_info, False, 'ssh/key/file')
def test_browse_dcos(self, get_subscription_id): acs_info = ContainerService(location="location", orchestrator_profile={}, master_profile={}, linux_profile={}) acs_info.orchestrator_profile = ContainerServiceOrchestratorProfile( orchestrator_type=ContainerServiceOrchestratorTypes.dcos) client, cmd = mock.MagicMock(), mock.MagicMock() with mock.patch( 'azure.cli.command_modules.acs.custom._dcos_browse_internal') as dcos_browse: _acs_browse_internal(client, cmd, acs_info, 'resource-group', 'name', False, 'ssh/key/file') dcos_browse.assert_called_with(acs_info, False, 'ssh/key/file')
def test_browse_k8s(self, get_subscription_id): acs_info = ContainerService("location", {}, {}, {}) acs_info.orchestrator_profile = ContainerServiceOrchestratorProfile( ContainerServiceOrchestratorTypes.kubernetes) with mock.patch('azure.cli.command_modules.acs.custom._get_acs_info', return_value=acs_info) as get_acs_info: with mock.patch( 'azure.cli.command_modules.acs.custom._k8s_browse_internal') as k8s_browse: _acs_browse_internal(acs_info, 'resource-group', 'name', False, 'ssh/key/file') get_acs_info.assert_called_with('name', 'resource-group') k8s_browse.assert_called_with('name', acs_info, False, 'ssh/key/file')
def create_update_acs(self): ''' Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. :return: deserialized ACS instance state dictionary ''' self.log("Creating / Updating the ACS instance {0}".format(self.name)) service_principal_profile = None agentpools = [] if self.agent_pool_profiles: for profile in self.agent_pool_profiles: self.log( "Trying to push the following Profile {0}".format(profile)) agentpools.append(create_agent_pool_profile_instance(profile)) if self.orchestration_platform == 'Kubernetes': service_principal_profile = create_service_principal_profile_instance( self.service_principal) parameters = ContainerService( location=self.location, tags=self.tags, orchestrator_profile=create_orch_platform_instance( self.orchestration_platform), service_principal_profile=service_principal_profile, linux_profile=create_linux_profile_instance(self.linux_profile), master_profile=create_master_profile_instance(self.master_profile), agent_pool_profiles=agentpools, diagnostics_profile=create_diagnostics_profile_instance( self.diagnostics_profile)) # self.log("orchestrator_profile : {0}".format(parameters.orchestrator_profile)) # self.log("service_principal_profile : {0}".format(parameters.service_principal_profile)) # self.log("linux_profile : {0}".format(parameters.linux_profile)) # self.log("ssh from yaml : {0}".format(results.get('linux_profile')[0])) # self.log("ssh : {0}".format(parameters.linux_profile.ssh)) # self.log("master_profile : {0}".format(parameters.master_profile)) # self.log("agent_pool_profiles : {0}".format(parameters.agent_pool_profiles)) # self.log("vm_diagnostics : {0}".format(parameters.diagnostics_profile.vm_diagnostics)) try: poller = self.containerservice_client.container_services.create_or_update( self.resource_group, self.name, parameters) response = self.get_poller_result(poller) except CloudError as exc: self.log('Error attempting to create the ACS instance.') self.fail("Error creating the ACS instance: {0}".format(str(exc))) return create_acs_dict(response)