def wait_for_deployment_ready(self, sctx): ctx = sctx.job_ctxs[sctx.current_job_index] adapter = VirtualMachineAdapter(ctx.subscription_id, ctx.pem_url, host=ctx.management_host) props = adapter.get_deployment_by_slot(ctx.cloud_service_name, ctx.deployment_slot) if not props: self.log.error( "azure virtual environment %d error occured while waiting for deployment ready" % sctx.current_job_index) self.__on_setup_failed(sctx) return if props.status == ADStatus.RUNNING: self.__wait_for_virtual_machine_ready(sctx) else: self.__wait_for_create_virtual_machine_deployment(sctx)