blackstack-deployer 1.2.21 → 1.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/blackstack-deployer.rb +20 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fcb05a3bbf4e274805db405a185da0a2c17ec95ded9485d6959697fc99255cb
|
4
|
+
data.tar.gz: 86376aa604ff30eb4240e4823decfec4ba1f7012c63143e727576671a646b2f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba274b243feb659a2b41b871096ddfcac4fc355994435c19973b3601b86e7e431500ec9a0a372db3f9602ef91783946eb5ebd2233db0e0aa9eeb83154ee42e51
|
7
|
+
data.tar.gz: 14ba1ae13f676cb5005cb0d6bac36025438329229f769e4337a923017632e95105365c1ef28db8f103c784d6f1a3acdeb1591fc9fe8ef1d73a5e622f78522c79
|
data/lib/blackstack-deployer.rb
CHANGED
@@ -166,17 +166,21 @@ module BlackStack
|
|
166
166
|
def run(node)
|
167
167
|
ret = []
|
168
168
|
self.commands.each do |c|
|
169
|
-
|
169
|
+
lines = c.command.to_s.strip.split(/\n/) # use this to make log more easy to read.
|
170
|
+
line_to_show = lines[0].size > 25 ? lines[0][0..25] + "..." : lines[0] # use this to make log more easy to read.
|
171
|
+
BlackStack::Deployer.logger.logs "Running command: #{line_to_show.to_s} #{lines.size > 1 ? "(+#{lines.size-1} more lines)" : ''}... "
|
172
|
+
#puts 'b1'
|
170
173
|
h = c.run(node)
|
174
|
+
#puts 'b2'
|
171
175
|
ret << h
|
172
176
|
|
173
177
|
#BlackStack::Deployer.logger.logs "Result: "
|
174
178
|
#BlackStack::Deployer.logger.logf h.to_s
|
175
179
|
|
176
180
|
if h[:errors].size == 0
|
177
|
-
|
181
|
+
BlackStack::Deployer.logger.done
|
178
182
|
else
|
179
|
-
|
183
|
+
BlackStack::Deployer.logger.logf('error: ' + h.to_s)
|
180
184
|
raise "Error running command:\n#{h[:errors].uniq.join("\n")}"
|
181
185
|
end
|
182
186
|
end
|
@@ -211,7 +215,7 @@ module BlackStack
|
|
211
215
|
# :reboot is a reserved word, so it is fine to call :reboot
|
212
216
|
else
|
213
217
|
# validate: existis a routine with a the value c[:command].to_s on its :name key
|
214
|
-
errors << "The routine with the name #{c[:command].to_s} does not exist" unless BlackStack::Deployer::
|
218
|
+
errors << "The routine with the name #{c[:command].to_s} does not exist" unless BlackStack::Deployer::routines.select { |r| r.name == c[:command].to_s }.size > 0
|
215
219
|
end
|
216
220
|
else
|
217
221
|
# validate: each line of the :command value must finish with ;
|
@@ -284,11 +288,16 @@ module BlackStack
|
|
284
288
|
end
|
285
289
|
end
|
286
290
|
end
|
291
|
+
#puts
|
292
|
+
#puts
|
293
|
+
#puts "command: #{self.command}"
|
294
|
+
#puts "h[:background] = #{h[:background]}"
|
287
295
|
if h.has_key?(:background)
|
288
296
|
self.background = h[:background]
|
289
297
|
else
|
290
298
|
self.background = false
|
291
|
-
end
|
299
|
+
end
|
300
|
+
#puts "self.background = #{self.background}"
|
292
301
|
end # def initialize(h)
|
293
302
|
|
294
303
|
def to_hash
|
@@ -338,6 +347,8 @@ module BlackStack
|
|
338
347
|
end
|
339
348
|
# if the command is configured to run in background, then modify the ret to run in background.
|
340
349
|
# note: even if you the flag show_ouput is on, you won't see any error message.
|
350
|
+
#puts
|
351
|
+
#puts "self.background: #{self.background.to_s}"
|
341
352
|
if self.background #&& !BlackStack::Deployer.show_output
|
342
353
|
lines = ret.strip.lines
|
343
354
|
total = lines.size
|
@@ -376,7 +387,6 @@ module BlackStack
|
|
376
387
|
l = BlackStack::Deployer.logger
|
377
388
|
errors = []
|
378
389
|
output = nil
|
379
|
-
s = self.code(node)
|
380
390
|
|
381
391
|
# if self.command is a symbol
|
382
392
|
if self.command.is_a?(Symbol)
|
@@ -397,7 +407,7 @@ module BlackStack
|
|
397
407
|
|
398
408
|
# if self.command is a string
|
399
409
|
elsif self.command.is_a?(String)
|
400
|
-
|
410
|
+
s = self.code(node)
|
401
411
|
# running the command
|
402
412
|
l.logs "Show command output... " if BlackStack::Deployer.show_output
|
403
413
|
l.log "\n\nCommand:\n--------\n\n#{s} " if BlackStack::Deployer.show_output
|
@@ -598,17 +608,17 @@ module BlackStack
|
|
598
608
|
|
599
609
|
# raise exception if any error has been found
|
600
610
|
raise "The routine #{routine_name} cannot be run on the node #{node_name}: #{errors.uniq.join(".\n")}" if errors.length > 0
|
601
|
-
|
611
|
+
#puts 'a'
|
602
612
|
# connect the node
|
603
613
|
#self.logger.logs "Connecting to node #{n.name}... "
|
604
614
|
n.connect
|
605
615
|
#self.logger.done
|
606
|
-
|
616
|
+
#puts 'b'
|
607
617
|
# run the routine
|
608
618
|
#self.logger.logs "Running routine #{r.name}... "
|
609
619
|
r.run(n)
|
610
620
|
#self.logger.done
|
611
|
-
|
621
|
+
#puts 'c'
|
612
622
|
# disconnect the node
|
613
623
|
#self.logger.logs "Disconnecting from node #{n.name}... "
|
614
624
|
n.disconnect
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blackstack-deployer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blackstack-nodes
|