How to use the cli-ux.cli.wait function in cli-ux

To help you get started, we’ve selected a few cli-ux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heroku / cli / packages / ps / src / commands / ps / wait.ts View on Github external
if (onLatest.length === relevantDynos.length) {
        if (!released) {
          cli.action.stop(`${releasedFraction}, done`)
        }
        break
      }

      if (released) {
        released = false
        cli.action.start(`Waiting for every dyno to be running v${latestRelease.version}`)
      }

      cli.action.status = releasedFraction

      // eslint-disable-next-line no-await-in-loop
      await cli.wait(interval * 1000)
    }
  }
}
github che-incubator / chectl / src / tasks / installers / operator.ts View on Github external
task: async (_ctx: any, _task: any) => {
          await cli.wait(1000)
          await kube.waitLatestReplica(this.operatorName, flags.chenamespace)
        }
      }
github che-incubator / chectl / src / api / che.ts View on Github external
async waitUntilReadyToShutdown(cheURL: string, intervalMs = 500, timeoutMs = 60000) {
    const iterations = timeoutMs / intervalMs
    for (let index = 0; index < iterations; index++) {
      let status = await this.getCheServerStatus(cheURL)
      if (status === 'READY_TO_SHUTDOWN') {
        return
      }
      await cli.wait(intervalMs)
    }
    throw new Error('ERR_TIMEOUT')
  }
github che-incubator / chectl / src / tasks / installers / operator.ts View on Github external
task: async (_ctx: any, task: any) => {
        if (await kh.crdExist(this.cheClusterCrd) &&
          await kh.cheClusterExist(this.operatorCheCluster, flags.chenamespace)) {
          await kh.deleteCheCluster(this.operatorCheCluster, flags.chenamespace)
          await cli.wait(2000) //wait a couple of secs for the finalizers to be executed
          task.title = await `${task.title}...OK`
        } else {
          task.title = await `${task.title}...CR not found`
        }
      }
    },
github che-incubator / chectl / src / api / kube.ts View on Github external
async waitForPodReady(selector: string, namespace = '', intervalMs = 500, timeoutMs = this.podReadyTimeout) {
    const iterations = timeoutMs / intervalMs
    for (let index = 0; index < iterations; index++) {
      let readyStatus = await this.getPodReadyConditionStatus(selector, namespace)
      if (readyStatus === 'True') {
        return
      }
      if (readyStatus !== 'False') {
        throw new Error(`ERR_BAD_READY_STATUS: ${readyStatus} (True or False expected) `)
      }
      await cli.wait(intervalMs)
    }
    throw new Error(`ERR_TIMEOUT: Timeout set to pod ready timeout ${this.podReadyTimeout}`)
  }
github che-incubator / chectl / src / api / kube.ts View on Github external
async waitLatestReplica(deploymentName: string, namespace = '', intervalMs = 500, timeoutMs = this.podWaitTimeout) {
    const iterations = timeoutMs / intervalMs
    for (let index = 0; index < iterations; index++) {
      const deployment = await this.getDeployment(deploymentName, namespace)
      if (!deployment) {
        throw new Error(`Deployment ${namespace}/${deploymentName} is not found.`)
      }

      const deploymentStatus = deployment.status
      if (!deploymentStatus) {
        throw new Error(`Deployment ${namespace}/${deploymentName} does not have any status`)
      }

      if (deploymentStatus.unavailableReplicas && deploymentStatus.unavailableReplicas > 0) {
        await cli.wait(intervalMs)
      } else {
        return
      }
    }

    throw new Error(`ERR_TIMEOUT: Timeout set to pod wait timeout ${this.podWaitTimeout}`)
  }
github SakkuCloud / sakku-cli / old / app.ts View on Github external
cli.action.stop('created!')
                this.log(`${appName} is ready to deploy :)`)
                break
            case 'stop':
                var appId = await cli.prompt('Enter your app id',{required:true})
                await cli.action.start('please wait...')
                await cli.wait(2000)
                cli.action.stop('stoped!')
                this.log(`your app (${appId}) is stoped`)
                break
            case 'rm':
                var appId = await cli.prompt('Enter your app id',{required:true})
                var confimation = await cli.confirm('are you really sure to remove?')
                if (confimation){
                    await cli.action.start('please wait...')
                    await cli.wait(2000)
                    cli.action.stop('removed!')
                    this.log('your app is not any more exist in this universe!')
                }else {
                    this.log('notting happend!')
                }
                break
            case 'scale':
                var appId = await cli.prompt('Enter your app id',{required:true})
                var appId = await cli.prompt('Enter your app scale',{required:true})
                
        }
    }
}
github che-incubator / chectl / src / api / kube.ts View on Github external
async waitForService(selector: string, namespace = '', intervalMs = 500, timeoutMs = 30000) {
    const iterations = timeoutMs / intervalMs
    for (let index = 0; index < iterations; index++) {
      let currentServices = await this.getServicesBySelector(selector, namespace)
      if (currentServices && currentServices.items.length > 0) {
        return
      }
      await cli.wait(intervalMs)
    }
    throw new Error(`ERR_TIMEOUT: Timeout set to waiting for service ${timeoutMs}`)
  }
github che-incubator / chectl / src / api / kube.ts View on Github external
async waitForPodPhase(selector: string, targetPhase: string, namespace = '', intervalMs = 500, timeoutMs = this.podWaitTimeout) {
    const iterations = timeoutMs / intervalMs
    for (let index = 0; index < iterations; index++) {
      let currentPhase = await this.getPodPhase(selector, namespace)
      if (targetPhase === currentPhase) {
        return
      }
      await cli.wait(intervalMs)
    }
    throw new Error(`ERR_TIMEOUT: Timeout set to pod wait timeout ${this.podWaitTimeout}`)
  }
github che-incubator / chectl / src / api / kube.ts View on Github external
async waitUntilPodIsDeleted(selector: string, namespace = '', intervalMs = 500, timeoutMs = this.podReadyTimeout) {
    const iterations = timeoutMs / intervalMs
    for (let index = 0; index < iterations; index++) {
      let readyStatus = await this.getPodReadyConditionStatus(selector, namespace)
      if (readyStatus === 'False') {
        return
      }
      if (readyStatus !== 'True') {
        throw new Error(`ERR_BAD_READY_STATUS: ${readyStatus} (True or False expected) `)
      }
      await cli.wait(intervalMs)
    }
    throw new Error(`ERR_TIMEOUT: Timeout set to pod ready timeout ${this.podReadyTimeout}`)
  }