gaptool-client 0.8.0.pre.beta → 0.8.0.pre.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/gaptool_client/commands.rb +21 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 002150433708bb563757f2ef3cc21fc87e0388e2
|
4
|
+
data.tar.gz: 64857892d8fbc611a72331e90a911239f808a562
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a756b321848f7c1bdaafcf41da7573a9d67b0398e44f684d6d591c0639f2edc3798b3dea1155af4f90819e3632fb3569474c75c12fb1bc34a46bbb9ecf88af7
|
7
|
+
data.tar.gz: a80fccd7831292c544a86f3e1e5545daad80294f4a6e1ac51e541766f139909ee7086117724185cf20ead681622c96b286ef1f3011ec1333bfb933dc91bd1be3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.0-
|
1
|
+
0.8.0-beta1
|
@@ -28,15 +28,13 @@ module Gaptool
|
|
28
28
|
res = Gaptool::API.client.addnode(zone, type, role, environment, nil, security_group,
|
29
29
|
ami, chef_repo, chef_branch, chef_runlist,
|
30
30
|
no_terminate)
|
31
|
-
if res['result'] == 'error'
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
res
|
38
|
-
puts "- #{k}: #{Rainbow(v).blue}"
|
39
|
-
end
|
31
|
+
Gaptool::Helpers.error(res['message']) if res['result'] == 'error'
|
32
|
+
res.merge(
|
33
|
+
'role' => role,
|
34
|
+
'environment' => environment
|
35
|
+
)
|
36
|
+
res.delete('secret')
|
37
|
+
Gaptool::Helpers.info([res], false, false)
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
@@ -52,22 +50,28 @@ module Gaptool
|
|
52
50
|
Gaptool::Helpers.info(nodes, false, false)
|
53
51
|
zone = node['zone'][0..-2]
|
54
52
|
if node['environment'] != environment || node['role'] != role
|
55
|
-
|
56
|
-
exit 1
|
53
|
+
Gaptool::Helpers.error("'#{node['role']}-#{node['environment']}' do not match provided value (#{role}-#{environment})")
|
57
54
|
end
|
58
|
-
if node['
|
59
|
-
puts Rainbow('"terminate" command is disabled for this instance').
|
60
|
-
|
55
|
+
if node['terminable'] == false
|
56
|
+
puts Rainbow('"terminate" command is disabled for this instance').yellow
|
57
|
+
puts 'To terminate the instance, set it as terminable first running:'
|
58
|
+
puts Rainbow("gt set -k terminable -v true -i #{instance}").cyan
|
59
|
+
puts
|
60
|
+
Gaptool::Helpers.error("Cannot terminate instance #{instance}",
|
61
|
+
code: 2)
|
61
62
|
end
|
62
63
|
print Rainbow('Terminate instance? [type yes to confirm]: ').green
|
63
64
|
res = $stdin.gets.chomp
|
64
65
|
return 0 unless res.downcase == 'yes'
|
65
66
|
puts "Terminating instance #{node['role']}:#{node['environment']}:#{node['instance']} in region #{zone}"
|
66
67
|
begin
|
67
|
-
Gaptool::API.client.terminatenode(instance, zone)
|
68
|
-
rescue
|
69
|
-
|
68
|
+
res = Gaptool::API.client.terminatenode(instance, zone)
|
69
|
+
rescue => e
|
70
|
+
Gaptool::Helpers.error("Cannot terminate instance: #{e}")
|
70
71
|
end
|
72
|
+
Gaptool::Helpers.error("Cannot terminate instance: #{res['message']}") \
|
73
|
+
if res['result'] == 'error'
|
74
|
+
puts Rainbow("Successfully terminated instance #{instance}").green
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|