blackstack-deployer 1.2.17 → 1.2.20
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 +35 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d18d657b11702c6216df79fea79448ddc9551be15b494f43fbbce5afe734a997
|
4
|
+
data.tar.gz: f532b2676c8f21bd4ffcc23f37f732bc7630dba88e2ba986baba7c585e2fbc63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39f74640d3ff4ae8de2e1a5c827524d74fe0a87cd82b775bde836fe02f45dce59423e6372f422010bc5dd8326815a7b255c8f9cf69deb53ceada0f48b5cfe9fb
|
7
|
+
data.tar.gz: f3e77987d1dd68ff263bca563e9931e812e01fc823ab707632eccedd791705288c81f6cbe84259de79bd08e8aef5db1f15b55e6e470e29f334f1af421c0869bb
|
data/lib/blackstack-deployer.rb
CHANGED
@@ -215,7 +215,13 @@ module BlackStack
|
|
215
215
|
end
|
216
216
|
else
|
217
217
|
# validate: each line of the :command value must finish with ;
|
218
|
-
errors << "Each line in the :command value must finish with `;`.\nCommand: #{c[:command]}.\nRefer https://github.com/leandrosardi/blackstack-deployer#67-running-commands-in-background for more details." unless c[:command].strip.split("\n").select { |l| l.strip[-1,1] != ';' }.size == 0
|
218
|
+
#errors << "Each line in the :command value must finish with `;`.\nCommand: #{c[:command]}.\nRefer https://github.com/leandrosardi/blackstack-deployer#67-running-commands-in-background for more details." unless c[:command].strip.split("\n").select { |l| l.strip.strip[-1,1] != ';' }.size == 0
|
219
|
+
c[:command].strip.split("\n").each { |l|
|
220
|
+
l.strip!
|
221
|
+
if l.strip[-1,1] != ';'
|
222
|
+
errors << "Each line in the :command value must finish with `;`.\nCommand: #{l}.\nRefer https://github.com/leandrosardi/blackstack-deployer#67-running-commands-in-background for more details."
|
223
|
+
end
|
224
|
+
}
|
219
225
|
end
|
220
226
|
|
221
227
|
# if c[:matches] exists
|
@@ -305,6 +311,9 @@ module BlackStack
|
|
305
311
|
# some parameters like `:show_outut` or `:background`.
|
306
312
|
def code(node)
|
307
313
|
ret = self.command
|
314
|
+
#puts
|
315
|
+
#puts
|
316
|
+
#puts "self.command: #{self.command}"
|
308
317
|
# replacing parameters
|
309
318
|
ret.scan(/%[a-zA-Z0-9\_]+%/).each do |p|
|
310
319
|
if p == '%eth0_ip%' # reserved parameter
|
@@ -314,11 +323,17 @@ module BlackStack
|
|
314
323
|
# TODO: move this to a timestamp function on blackstack-core
|
315
324
|
ret.gsub!(p, Time.now.to_s.gsub(/\D/, ''))
|
316
325
|
else
|
326
|
+
#puts
|
327
|
+
#puts
|
328
|
+
#puts "p: #{p}"
|
317
329
|
if node.parameters.has_key?(p.gsub(/%/, '').to_sym)
|
318
330
|
ret.gsub!(p, node.parameters[p.gsub(/%/, '').to_sym].to_s)
|
319
331
|
else
|
320
332
|
raise "The parameter #{p} does not exist in the node descriptor #{node.parameters.to_s}"
|
321
333
|
end
|
334
|
+
#puts
|
335
|
+
#puts
|
336
|
+
#puts "ret: #{ret}"
|
322
337
|
end
|
323
338
|
end
|
324
339
|
# if the command is configured to run in background, and the flag show_ouput is off, then modify the ret to run in background
|
@@ -336,9 +351,25 @@ module BlackStack
|
|
336
351
|
}
|
337
352
|
ret = lines.join("\n")
|
338
353
|
end
|
354
|
+
# apply modifications due the sudo flag
|
339
355
|
# return the code
|
356
|
+
ret = node.code(ret, self.sudo)
|
357
|
+
#puts
|
358
|
+
#puts
|
359
|
+
#puts 'lalala'
|
360
|
+
#puts ret
|
361
|
+
=begin
|
362
|
+
if self.sudo
|
363
|
+
if node.using_password?
|
364
|
+
ret = "echo '#{node.ssh_password.gsub(/'/, "\\\\'")}' | sudo -S su root -c '#{ret}'"
|
365
|
+
elsif node.using_private_key_file?
|
366
|
+
ret = "sudo -S su root -c '#{ret}'"
|
367
|
+
end
|
368
|
+
end
|
369
|
+
=end
|
370
|
+
# return
|
340
371
|
ret
|
341
|
-
|
372
|
+
end
|
342
373
|
|
343
374
|
def run(node)
|
344
375
|
l = BlackStack::Deployer.logger
|
@@ -369,12 +400,12 @@ module BlackStack
|
|
369
400
|
# running the command
|
370
401
|
l.logs "Show command output... " if BlackStack::Deployer.show_output
|
371
402
|
l.log "\n\nCommand:\n--------\n\n#{s} " if BlackStack::Deployer.show_output
|
372
|
-
output = node.exec(s
|
403
|
+
output = node.ssh.exec!(s)
|
373
404
|
l.log "\n\nOutput:\n-------\n\n#{output}" if BlackStack::Deployer.show_output
|
374
405
|
l.logf('done tracing.') if BlackStack::Deployer.show_output
|
375
406
|
|
376
407
|
# validation: at least one of the matches should happen
|
377
|
-
if self.matches.size > 0
|
408
|
+
if self.matches.size > 0 && !self.background
|
378
409
|
i = 0
|
379
410
|
self.matches.each do |m|
|
380
411
|
if m.validate(output).size == 0 # no errors
|
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.20
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blackstack-nodes
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.2.
|
19
|
+
version: 1.2.10
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.2.
|
22
|
+
version: 1.2.10
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.2.
|
29
|
+
version: 1.2.10
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.2.
|
32
|
+
version: 1.2.10
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: pg
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|