canzea 0.1.167 → 0.1.169
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canzea/version.rb +1 -1
- data/lib/canzea.rb +21 -1
- data/lib/helper-run-class.rb +17 -0
- 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: edbee97c1b07b60b9997785cfb6e44e03bd6e6d0
|
4
|
+
data.tar.gz: 0ee47c5b577630b8865577c78b495068e16d013c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea1e4897f63a6944896959402bde08541dbc061b2d8fddf41889db01a91aed185668809d3c68fb048143b92e5d23ec8b16cbc8677c316988e1bbfdc4b47b8421
|
7
|
+
data.tar.gz: 7e64916dfa5ce4da01ef2329b771e36ce1d90518ccc0bb78847378d0f1b4cc774ff01335ad1ef89c98599f4c538136855a7dd6f925ab7cddc4c68f24430a4d2e
|
data/lib/canzea/version.rb
CHANGED
data/lib/canzea.rb
CHANGED
@@ -139,11 +139,27 @@ module Canzea
|
|
139
139
|
RegisterMetadata.new.do(opts[:role], opts[:solution], test)
|
140
140
|
end
|
141
141
|
|
142
|
+
if (util == "run-command")
|
143
|
+
args = JSON.parse(opts.fetch(:args, "{}"))
|
144
|
+
|
145
|
+
# If there are args, then parse them and put them in environment variables
|
146
|
+
args.keys.each { | k |
|
147
|
+
if args[k].instance_of? String
|
148
|
+
puts "-- SETTING #{k.upcase} = #{args[k].to_str}"
|
149
|
+
ENV[k.upcase] = args[k].to_str
|
150
|
+
end
|
151
|
+
}
|
152
|
+
|
153
|
+
ps = HelperRun.new opts.fetch(:raw, false)
|
154
|
+
ps.runCommand args['cmd']
|
155
|
+
end
|
156
|
+
|
142
157
|
if (util == "analyze-command")
|
143
158
|
step = Integer(opts.fetch(:step, '0'))
|
144
159
|
|
145
160
|
list = []
|
146
161
|
args = JSON.parse(opts.fetch(:args, "{'phases'=>['install']}"))
|
162
|
+
|
147
163
|
phases = args['phases']
|
148
164
|
|
149
165
|
publicIp = File.read("#{Canzea::config[:pwd]}/vps-#{opts[:serverBase]}-#{opts[:serverNumber]}.json")
|
@@ -173,7 +189,11 @@ module Canzea
|
|
173
189
|
if index >= step
|
174
190
|
puts "[#{index}] #{cmd}"
|
175
191
|
|
176
|
-
|
192
|
+
args['cmd'] = cmd
|
193
|
+
jsonArgs = args.to_json
|
194
|
+
fullCommand = "canzea --util=run-command --args=#{jsonArgs}"
|
195
|
+
|
196
|
+
RemoteRun.new.doCommand publicIp, opts[:privateKey], fullCommand
|
177
197
|
else
|
178
198
|
puts "[#{index}] SKIP #{cmd}"
|
179
199
|
end
|
data/lib/helper-run-class.rb
CHANGED
@@ -86,4 +86,21 @@ class HelperRun
|
|
86
86
|
abort()
|
87
87
|
end
|
88
88
|
end
|
89
|
+
|
90
|
+
def runCommand (cmd)
|
91
|
+
|
92
|
+
begin
|
93
|
+
|
94
|
+
r = RunnerWorker.new @raw
|
95
|
+
|
96
|
+
r.run cmd, 1, 1, status
|
97
|
+
|
98
|
+
rescue => exception
|
99
|
+
@log.error(cmd)
|
100
|
+
@log.error(exception.to_s)
|
101
|
+
@log.error(exception.backtrace)
|
102
|
+
abort()
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
89
106
|
end
|