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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68a9d97413a05181ebcdd93e39faa46e946e50dd
4
- data.tar.gz: ba3b4cd9f6fa62331d5bd6c2904f3d514a93cc6e
3
+ metadata.gz: 002150433708bb563757f2ef3cc21fc87e0388e2
4
+ data.tar.gz: 64857892d8fbc611a72331e90a911239f808a562
5
5
  SHA512:
6
- metadata.gz: f5d78cf78d710d30f1af5dee705354058c4a64d8fcf86c8baa2c288040ed6595ce368388e8a9263a07d57cd748435d51ab827701d4429773041907193f77df67
7
- data.tar.gz: b4c9059eb0d8007b959637cf5ad56e40f5c92301590fd953fb07891c48c2819ace4a0df49763fb458ba0b769ba9ba92d9abd329d1aba5d968230637624e81e9e
6
+ metadata.gz: 5a756b321848f7c1bdaafcf41da7573a9d67b0398e44f684d6d591c0639f2edc3798b3dea1155af4f90819e3632fb3569474c75c12fb1bc34a46bbb9ecf88af7
7
+ data.tar.gz: a80fccd7831292c544a86f3e1e5545daad80294f4a6e1ac51e541766f139909ee7086117724185cf20ead681622c96b286ef1f3011ec1333bfb933dc91bd1be3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.0-beta
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
- puts Rainbow(res['message']).red
33
- exit 1
34
- end
35
-
36
- puts "#{Rainbow('Successfully init instance').green} #{Rainbow(res['instance']).blue}:"
37
- res.select { |k, _| k != 'instance' && k != 'secret' }.sort.each do |k, v|
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
- puts Rainbow("'#{node['role']}-#{node['environment']}' do not match provided value (#{role}-#{environment})").red
56
- exit 1
53
+ Gaptool::Helpers.error("'#{node['role']}-#{node['environment']}' do not match provided value (#{role}-#{environment})")
57
54
  end
58
- if node['terminate'] == 'false'
59
- puts Rainbow('"terminate" command is disabled for this instance').red
60
- exit 2
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
- puts Rainbow('Cannot terminate instance').red
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
 
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.8.0.pre.beta
4
+ version: 0.8.0.pre.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Laurita