Class: SimpleDeploy::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_deploy/stack/status.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Status

Returns a new instance of Status.



4
5
6
7
8
# File 'lib/simple_deploy/stack/status.rb', line 4

def initialize(args)
  @name = args[:name]
  @config = SimpleDeploy.config
  @logger = SimpleDeploy.logger
end

Instance Method Details

#cleanup_in_progress?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/simple_deploy/stack/status.rb', line 18

def cleanup_in_progress?
  /_CLEANUP_IN_PROGRESS$/ === current
end

#complete?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/simple_deploy/stack/status.rb', line 10

def complete?
  /_COMPLETE$/ === current
end

#create_failed?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/simple_deploy/stack/status.rb', line 26

def create_failed?
  'CREATE_FAILED' == current
end

#failed?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/simple_deploy/stack/status.rb', line 14

def failed?
  /_FAILED$/ === current
end

#in_progress?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/simple_deploy/stack/status.rb', line 22

def in_progress?
  /_IN_PROGRESS$/ === current && !cleanup_in_progress?
end

#stable?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/simple_deploy/stack/status.rb', line 30

def stable?
  (complete? || failed?) && (! create_failed?)
end

#wait_for_stable(count = 25) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/simple_deploy/stack/status.rb', line 34

def wait_for_stable(count=25)
  1.upto(count).each do |c|
    break if stable?
    @logger.info ("#{@name} not stable (#{current}).  Sleeping #{c * c} second(s).")
    Kernel.sleep (c * c)
  end
  stable?
end