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
14
# File 'lib/aptible/cli/helpers/operation.rb', line 9

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

#wait_for_completion(operation) ⇒ Object



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

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