ec2-blackout 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ec2-blackout/shutdown.rb +2 -2
- data/lib/ec2-blackout/startup.rb +1 -1
- data/lib/ec2-blackout/version.rb +1 -1
- metadata +1 -1
@@ -13,7 +13,7 @@ class Ec2::Blackout::Shutdown
|
|
13
13
|
if stoppable? instance
|
14
14
|
@ui.say "-> Stopping instance: #{instance.id}, name: #{instance.tags['Name']}"
|
15
15
|
unless dry_run?
|
16
|
-
instance.add_tag('ec2:blackout:on',
|
16
|
+
instance.add_tag('ec2:blackout:on', :value => Time.now.utc)
|
17
17
|
instance.stop
|
18
18
|
end
|
19
19
|
elsif instance.status == :running
|
@@ -32,7 +32,7 @@ class Ec2::Blackout::Shutdown
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def stoppable? instance
|
35
|
-
(instance.status == :running && exclude_tag && !instance.tags
|
35
|
+
(instance.status == :running && exclude_tag && !instance.tags.to_h.key?(exclude_tag)) or
|
36
36
|
(instance.status == :running && exclude_tag.nil?)
|
37
37
|
end
|
38
38
|
|
data/lib/ec2-blackout/startup.rb
CHANGED
@@ -32,7 +32,7 @@ class Ec2::Blackout::Startup
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def startable? instance
|
35
|
-
(instance.status == :stopped && instance.tags
|
35
|
+
(instance.status == :stopped && instance.tags.to_h.key?('ec2:blackout:on')) or
|
36
36
|
(instance.status == :stopped && @options[:force])
|
37
37
|
end
|
38
38
|
|
data/lib/ec2-blackout/version.rb
CHANGED