gaptool-client 0.6.9 → 0.6.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b4c3227e264f1cf2753136f4d185795823a116c
4
- data.tar.gz: dc62f6bb3b7a150b522598026147da788d957e2c
3
+ metadata.gz: 9f2dbf8298421010e2dd67ae75167d8c04f72da4
4
+ data.tar.gz: 1f541cbbaf0433a4d8046a113690ad0ad9f25852
5
5
  SHA512:
6
- metadata.gz: c437577e81da79143716bccc9ee5a635dc09a5436c5015fd23494424ff2379c2993623929d114a71298709ff02db59a8fe85df71cfd430e0a1b4f2b86777330a
7
- data.tar.gz: b5fac408a2cfb5f4385d6e172b7c46a6ceacb67942752dba45b707af8a1632b2002e4bd5fa50a4b6fc5f99f353bbbcaff27d16fbd0f1aab5560ba788b3be2ca4
6
+ metadata.gz: dde55851d33ad1307787498b4ad975c5520432cdc9fd576b3d0955b7c51bb34d3c229ad5902732eec428ebf7b34f6d6f5f7381d755a4344f5f940bcc15f57472
7
+ data.tar.gz: e9ad6c6ac2ed2bfd9e284d75be10b6d9dedfd4c6f07aba44118fcfe01c4cc6eef16b972c4bfce26d264cd2e4f4ad14b1ac94cb6852a5e1ec1f71d1cdee7cc023
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.9
1
+ 0.6.11
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.add_runtime_dependency 'clamp', "~> 0.6"
32
32
  s.add_runtime_dependency 'net-ssh', "~> 2.9"
33
33
  s.add_runtime_dependency 'net-scp', "~> 1.2"
34
- s.add_runtime_dependency 'gaptool-api', "~> 0.6", ">= 0.6.3"
34
+ s.add_runtime_dependency 'gaptool-api', "~> 0.6", ">= 0.6.4"
35
35
  s.add_runtime_dependency 'builder', "~> 3"
36
36
 
37
37
  s.add_development_dependency 'shoulda', "~> 3"
@@ -104,25 +104,43 @@ module Gaptool
104
104
  option ["-C", "--chef-repo"], "GITURL", "git url for the chef repository", :requireds => false
105
105
  option ["-b", "--chef-branch"], "BRANCH", "branch of the chef repository to use", :required => false
106
106
  option ['-R', "--chef_runlist"], 'RECIPE|ROLE', 'override chef run_list. recipe[cb::recipe] or role[myrole]. Can be specified multiple times', :multivalued => true, :attribute_name => 'chef_runlist'
107
+ option ['--no-terminate'], :flag, "Protect this instance from being terminated"
107
108
  def execute
109
+ no_terminate = no_terminate? ? true : nil
108
110
  $api.addnode(zone, type, role, environment, nil,
109
- security_group, ami, chef_repo, chef_branch, chef_runlist)
111
+ security_group, ami, chef_repo, chef_branch, chef_runlist,
112
+ no_terminate)
110
113
  end
111
114
  end
112
115
 
113
116
  class TerminateCommand < Clamp::Command
114
117
  option ["-i", "--instance"], "INSTANCE", "Instance ID, e.g. i-12345678", :required => true
115
118
  option ["-z", "--zone"], "ZONE", "AWS region of the node (deprecated/ignored)", :default => nil
119
+ option ["-r", "--role"], "ROLE", "Resource name to initilize", :required => true
120
+ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
116
121
  def execute
117
122
  node = $api.getonenode(instance)
118
123
  nodes = [node]
124
+ puts node.inspect
119
125
  infohelper(nodes, false, false)
120
126
  zone = node['zone'][0..-2]
121
- print Rainbow("Terminate instance? [type yes to confirm]: ").red
127
+ if node['environment'] != environment || node['role'] != role
128
+ puts Rainbow("'#{node['role']}-#{node['environment']}' do not match provided value (#{role}-#{environment})").red
129
+ exit 1
130
+ end
131
+ if node['terminate'] == 'false'
132
+ puts Rainbow('"terminate" command is disabled for this instance').red
133
+ exit 2
134
+ end
135
+ print Rainbow("Terminate instance? [type yes to confirm]: ").green
122
136
  res = $stdin.gets.chomp
123
137
  if res.downcase == 'yes'
124
138
  puts "Terminating instance #{node['role']}:#{node['environment']}:#{node['instance']} in region #{zone}"
125
- $api.terminatenode(instance, zone)
139
+ begin
140
+ res = $api.terminatenode(instance, zone)
141
+ rescue
142
+ puts Rainbow('Cannot terminate instance').red
143
+ end
126
144
  end
127
145
  end
128
146
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gaptool-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.9
4
+ version: 0.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Laurita
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-23 00:00:00.000000000 Z
13
+ date: 2014-09-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -105,7 +105,7 @@ dependencies:
105
105
  version: '0.6'
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: 0.6.3
108
+ version: 0.6.4
109
109
  type: :runtime
110
110
  prerelease: false
111
111
  version_requirements: !ruby/object:Gem::Requirement
@@ -115,7 +115,7 @@ dependencies:
115
115
  version: '0.6'
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
- version: 0.6.3
118
+ version: 0.6.4
119
119
  - !ruby/object:Gem::Dependency
120
120
  name: builder
121
121
  requirement: !ruby/object:Gem::Requirement