gaptool-client 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/gaptool-client.gemspec +1 -1
- data/lib/gaptool-client.rb +43 -46
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/gaptool-client.gemspec
CHANGED
data/lib/gaptool-client.rb
CHANGED
@@ -7,6 +7,49 @@ require 'clamp'
|
|
7
7
|
require 'net/ssh'
|
8
8
|
require 'net/scp'
|
9
9
|
|
10
|
+
def infohelper(nodes, parseable, grepable)
|
11
|
+
if parseable
|
12
|
+
puts nodes.to_json
|
13
|
+
else
|
14
|
+
nodes.each do |node|
|
15
|
+
@host = "#{node['role']}:#{node['environment']}:#{node['instance']}"
|
16
|
+
unless grepable
|
17
|
+
puts @host.color(:green)
|
18
|
+
end
|
19
|
+
node.keys.each do |key|
|
20
|
+
if grepable
|
21
|
+
puts "#{@host}|#{key}|#{node[key]}"
|
22
|
+
else
|
23
|
+
unless key == node.keys.last
|
24
|
+
puts " ┠ #{key.color(:cyan)}: #{node[key]}"
|
25
|
+
else
|
26
|
+
puts " ┖ #{key.color(:cyan)}: #{node[key]}\n\n"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def sshcmd(node, commands)
|
35
|
+
Net::SSH.start(
|
36
|
+
node['hostname'],
|
37
|
+
'admin',
|
38
|
+
:key_data => [$api.ssh(node['role'], node['environment'], node['instance'])['key']],
|
39
|
+
:config => false,
|
40
|
+
:keys_only => true,
|
41
|
+
:paranoid => false
|
42
|
+
) do |ssh|
|
43
|
+
commands.each do |command|
|
44
|
+
command.color(:cyan)
|
45
|
+
ssh.exec! command do
|
46
|
+
|ch, stream, line|
|
47
|
+
puts "#{node['role'].color(:yellow)}:#{node['environment'].color(:yellow)}:#{node['instance'].color(:yellow)}> #{line}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
10
53
|
module Gaptool
|
11
54
|
class InitCommand < Clamp::Command
|
12
55
|
option ["-r", "--role"], "ROLE", "Resource name to initilize", :required => true
|
@@ -77,54 +120,8 @@ module Gaptool
|
|
77
120
|
end
|
78
121
|
infohelper(@nodes, parseable?, grepable?)
|
79
122
|
end
|
80
|
-
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
def infohelper(nodes, parseable, grepable)
|
85
|
-
if parseable
|
86
|
-
puts nodes.to_json
|
87
|
-
else
|
88
|
-
nodes.each do |node|
|
89
|
-
@host = "#{node['role']}:#{node['environment']}:#{node['instance']}"
|
90
|
-
unless grepable
|
91
|
-
puts @host.color(:green)
|
92
|
-
end
|
93
|
-
node.keys.each do |key|
|
94
|
-
if grepable
|
95
|
-
puts "#{@host}|#{key}|#{node[key]}"
|
96
|
-
else
|
97
|
-
unless key == node.keys.last
|
98
|
-
puts " ┠ #{key.color(:cyan)}: #{node[key]}"
|
99
|
-
else
|
100
|
-
puts " ┖ #{key.color(:cyan)}: #{node[key]}\n\n"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def sshcmd(node, commands)
|
109
|
-
Net::SSH.start(
|
110
|
-
node['hostname'],
|
111
|
-
'admin',
|
112
|
-
:key_data => [$api.ssh(node['role'], node['environment'], node['instance'])['key']],
|
113
|
-
:config => false,
|
114
|
-
:keys_only => true,
|
115
|
-
:paranoid => false
|
116
|
-
) do |ssh|
|
117
|
-
commands.each do |command|
|
118
|
-
command.color(:cyan)
|
119
|
-
ssh.exec! command do
|
120
|
-
|ch, stream, line|
|
121
|
-
puts "#{node['role'].color(:yellow)}:#{node['environment'].color(:yellow)}:#{node['instance'].color(:yellow)}> #{line}"
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
123
|
end
|
126
124
|
|
127
|
-
|
128
125
|
class ChefrunCommand < Clamp::Command
|
129
126
|
option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
|
130
127
|
option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
|
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.3.
|
4
|
+
version: 0.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -239,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
239
|
version: '0'
|
240
240
|
segments:
|
241
241
|
- 0
|
242
|
-
hash:
|
242
|
+
hash: 3790817521907323443
|
243
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
244
|
none: false
|
245
245
|
requirements:
|