Sha256: 26c460f0493c68c253d6b17eb3952a5661c237b265c6c769d6b88002c73e6cf4

Contents?: true

Size: 567 Bytes

Versions: 10

Compression:

Stored size: 567 Bytes

Contents

require 'aptible/api'

module Aptible
  module CLI
    module Helpers
      module Operation
        POLL_INTERVAL = 1

        def poll_for_success(operation)
          wait_for_completion operation
          return if operation.status == 'succeeded'
          fail Thor::Error,
               'Operation failed. Please contact support@aptible.com'
        end

        def wait_for_completion(operation)
          while %w(queued running).include? operation.status
            sleep 1
            operation.get
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
aptible-cli-0.5.12 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.11 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.10 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.9 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.8 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.7 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.6 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.5 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.4 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.2 lib/aptible/cli/helpers/operation.rb