Module: Aptible::CLI::Helpers::Operation

Defined in:
lib/aptible/cli/helpers/operation.rb

Constant Summary collapse

POLL_INTERVAL =
1

Instance Method Summary collapse

Instance Method Details

#poll_for_success(operation) ⇒ Object



9
10
11
12
13
# File 'lib/aptible/cli/helpers/operation.rb', line 9

def poll_for_success(operation)
  wait_for_completion operation
  return if operation.status == 'succeeded'
  fail Thor::Error, 'Operation failed: please check logs'
end

#wait_for_completion(operation) ⇒ Object



15
16
17
18
19
20
# File 'lib/aptible/cli/helpers/operation.rb', line 15

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