Sha256: b9ca3227d9b8eeb49fb24ede5b3038ff0911b63fd6639c71edbf06d659d95806

Contents?: true

Size: 993 Bytes

Versions: 10

Compression:

Stored size: 993 Bytes

Contents

# frozen_string_literal: true

module Command
  class PsWait < Base
    NAME = "ps:wait"
    OPTIONS = [
      app_option(required: true),
      workload_option
    ].freeze
    DESCRIPTION = "Waits for workloads in app to be ready after re-deployment"
    LONG_DESCRIPTION = <<~DESC
      - Waits for workloads in app to be ready after re-deployment
    DESC
    EXAMPLES = <<~EX
      ```sh
      # Waits for all workloads in app.
      cpl ps:wait -a $APP_NAME

      # Waits for a specific workload in app.
      cpl ps:swait -a $APP_NAME -w $WORKLOAD_NAME
      ```
    EX

    def call
      @workloads = [config.options[:workload]] if config.options[:workload]
      @workloads ||= config[:app_workloads] + config[:additional_workloads]

      @workloads.reverse_each do |workload|
        step("Waiting for workload '#{workload}' to be ready", retry_on_failure: true) do
          cp.workload_deployments_ready?(workload, expected_status: true)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cpl-1.4.0 lib/command/ps_wait.rb
cpl-1.3.0 lib/command/ps_wait.rb
cpl-1.2.0 lib/command/ps_wait.rb
cpl-1.1.2 lib/command/ps_wait.rb
cpl-1.1.2.rc.0 lib/command/ps_wait.rb
cpl-1.1.1 lib/command/ps_wait.rb
cpl-1.1.0 lib/command/ps_wait.rb
cpl-1.0.4 lib/command/ps_wait.rb
cpl-1.0.3 lib/command/ps_wait.rb
cpl-1.0.2 lib/command/ps_wait.rb