Sha256: 1df53781dd31ec6f8ca687655f1983b75722c2535d4dd33d77b697f3b8fe9c4b

Contents?: true

Size: 535 Bytes

Versions: 8

Compression:

Stored size: 535 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 check logs'
        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

8 entries across 8 versions & 1 rubygems

Version Path
aptible-cli-0.5.1 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.5.0 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.4.4 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.4.3 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.4.2 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.4.1 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.4.0 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.3.7 lib/aptible/cli/helpers/operation.rb