blackstack-deployer 1.2.18 → 1.2.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/blackstack-deployer.rb +33 -4
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1b14b1870b2b15b1f26f5b6087e4ceb672e375fce44d02ea7ae36d658d690c3
4
- data.tar.gz: ff442f3dc4231513d28147431c859bc0791114a57d7085e90903e6aa7a09b7b2
3
+ metadata.gz: 352e8143167fb520bb742fecbedf3c43daaa6f517a5cd4c3351ce70eb04c7239
4
+ data.tar.gz: fc4ff4649a5fd482812e8acc624f44c04ef9a13eb3573f6ba91cca24c78371fb
5
5
  SHA512:
6
- metadata.gz: 1080f3ec0c42bd3d0d47405f988a7ce6d3173340026c570b1442e2cbcb83ad68169eecb8987f61317a3adfce36f23f5cbabd56d1341ac2c027a06841dff89824
7
- data.tar.gz: d11e282d1b7653cdb69c567f865f23a82d1a6b147f2e0258bd5e1371b92cf5864f17173a81c505010384e95b923c7bcf208e69a06cb25905151170e39e05cbce
6
+ metadata.gz: 9b981b975934c4786fcfbfbfa8ae135b7753f670b30937cc1517b93f2878fbc9fb69f42962a230ec699f451519730b2cd05a5480c28deede4db569f3aa9cac9c
7
+ data.tar.gz: 80d6b0bc534572be9c7d92a5faf51bf5c1e222bd65a9cab4fffac646b19febb5c8da56e59b6df27de3e814a76459c8316c17bd0296d7fcfb88f8001d862fea5a
@@ -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,15 +323,22 @@ 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
- # if the command is configured to run in background, and the flag show_ouput is off, then modify the ret to run in background
325
- if self.background && !BlackStack::Deployer.show_output
339
+ # if the command is configured to run in background, then modify the ret to run in background.
340
+ # note: even if you the flag show_ouput is on, you won't see any error message.
341
+ if self.background #&& !BlackStack::Deployer.show_output
326
342
  lines = ret.strip.lines
327
343
  total = lines.size
328
344
  i = 0
@@ -339,6 +355,19 @@ module BlackStack
339
355
  # apply modifications due the sudo flag
340
356
  # return the code
341
357
  ret = node.code(ret, self.sudo)
358
+ #puts
359
+ #puts
360
+ #puts 'lalala'
361
+ #puts ret
362
+ =begin
363
+ if self.sudo
364
+ if node.using_password?
365
+ ret = "echo '#{node.ssh_password.gsub(/'/, "\\\\'")}' | sudo -S su root -c '#{ret}'"
366
+ elsif node.using_private_key_file?
367
+ ret = "sudo -S su root -c '#{ret}'"
368
+ end
369
+ end
370
+ =end
342
371
  # return
343
372
  ret
344
373
  end
@@ -372,7 +401,7 @@ module BlackStack
372
401
  # running the command
373
402
  l.logs "Show command output... " if BlackStack::Deployer.show_output
374
403
  l.log "\n\nCommand:\n--------\n\n#{s} " if BlackStack::Deployer.show_output
375
- output = node.exec(s, false) # false: I already evaluated the :sudo parameter in the code method above.
404
+ output = node.ssh.exec!(s)
376
405
  l.log "\n\nOutput:\n-------\n\n#{output}" if BlackStack::Deployer.show_output
377
406
  l.logf('done tracing.') if BlackStack::Deployer.show_output
378
407
 
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.18
4
+ version: 1.2.21
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-06 00:00:00.000000000 Z
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.9
19
+ version: 1.2.10
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.2.9
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.9
29
+ version: 1.2.10
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.2.9
32
+ version: 1.2.10
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pg
35
35
  requirement: !ruby/object:Gem::Requirement