ec2-blackout 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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', :value => Time.now.utc)
16
+ tag(instance)
17
17
  instance.stop
18
18
  end
19
19
  elsif instance.status == :running
@@ -43,4 +43,11 @@ class Ec2::Blackout::Shutdown
43
43
  def dry_run?
44
44
  @options[:dry_run]
45
45
  end
46
+
47
+ def tag instance
48
+ instance.add_tag('ec2:blackout:on', :value => Time.now.utc)
49
+ if instance.has_elastic_ip?
50
+ instance.add_tag('ec2:blackout:eip', :value => instance.elastic_ip)
51
+ end
52
+ end
46
53
  end
@@ -15,6 +15,10 @@ class Ec2::Blackout::Startup
15
15
  unless dry_run?
16
16
  instance.tags.delete('ec2:blackout:on')
17
17
  instance.start
18
+ if instance.tags['ec2:blackout:eip']
19
+ instance.associate_elastic_ip(instance.tags['ec2:blackout:eip']) rescue nil
20
+ instance.tags.delete('ec2:blackout:eip')
21
+ end
18
22
  end
19
23
  elsif instance.status == :stopped
20
24
  @ui.say "-> Skipping instance: #{instance.id}, name: #{instance.tags['Name'] || 'N/A'}"
@@ -1,6 +1,6 @@
1
1
  module Ec2
2
2
  module Blackout
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
 
5
5
  def self.name
6
6
  'ec2-blackout'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2-blackout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-20 00:00:00.000000000 Z
12
+ date: 2013-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander