def __config_virtual_machine(self, sctx): ctx = sctx.job_ctxs[sctx.current_job_index] ctx.vm_need_config = False adapter = VirtualMachineAdapter(ctx.subscription_id, ctx.pem_url, host=ctx.management_host) network_config = get_network_config( ctx.raw_network_config, adapter.get_assigned_endpoints(ctx.cloud_service_name)) if len(network_config.input_endpoints.input_endpoints) == 0: # don't need to config, skip self.__setup_virtual_machine_done(sctx) return try: req = adapter.update_virtual_machine_network_config( ctx.cloud_service_name, ctx.deployment_name, ctx.virtual_machine_name, network_config) except Exception as e: self.log.error( "azure virtual environment %d error while config network: %r" % (sctx.current_job_index, e.message)) self.__on_setup_failed(sctx) return ctx.request_id = req.request_id self.__wait_for_config_virtual_machine(sctx)