Class: HaveAPI::CLI::Commands::ActionStateWait

Inherits:
HaveAPI::CLI::Command show all
Defined in:
lib/haveapi/cli/commands/action_state_wait.rb

Instance Attribute Summary

Attributes inherited from HaveAPI::CLI::Command

#global_opts

Instance Method Summary collapse

Methods inherited from HaveAPI::CLI::Command

args, cmd, desc, handle?, #initialize, #options

Constructor Details

This class inherits a constructor from HaveAPI::CLI::Command

Instance Method Details

#exec(args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/haveapi/cli/commands/action_state_wait.rb', line 9

def exec(args)
  if args.size < 1
    warn "Provide argument STATE ID"
    exit(false)
  end

  @api.set_opts(block: false)

  state = HaveAPI::CLI::ActionState.new(
      @global_opts,
      @api,
      args.first.to_i
  )
  ret = state.wait_for_completion(timeout: @global_opts[:timeout])

  if ret.nil?
    warn "Timeout"
    exit(false)
  end
end