blackstack-deployer 1.2.19 → 1.2.22

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 +41 -5
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dfec0f6c8509d10655041122a6e4c80d536edf5835232a9e1606443cfc7635c
4
- data.tar.gz: cad9f6289af37135b3a1e3fd2cb31708c1d4f76c90e7598b7b51f3c0798c3430
3
+ metadata.gz: 596376713a5b5eab0a27f97e8601c59188c5436e26e3312f4d783c3e129e415a
4
+ data.tar.gz: 83d61e633596e2c4963bd3e7a5d1907630363d5968de96c6544c2916c07e5041
5
5
  SHA512:
6
- metadata.gz: 41b6b36ab5294ea1b64a954ed5389aab6004422933cf814b4b7adc67dad15f22ac48c63b67931496be104fd2b69447a999158f4325406e22d4dbd504c3a6376a
7
- data.tar.gz: f476bfaa60b97e39f08f019c301d9281249e79f31c349813a2a2fe691ae29f0fdda4ba60a09564e2f8a29e2fa99333a41f3c6f6f5c956d289c4517661ea370c1
6
+ metadata.gz: e3271ce02a03667a0725a3fc2fd3025cdd7c6662176226acf1ad69bb13f162a3b5e5ca81613d07fbccc6271ff2c20c85a4010af88273f9d6183925670b63dc4f
7
+ data.tar.gz: 753d60764dbef8249eb23d64a6b0b9eebb9029ba7a4b9325377bd3dc35bc44e837dd2d45e199f90491577e2fe07e4d682d05d288d0f2531d39a8000f17557120
@@ -211,11 +211,17 @@ module BlackStack
211
211
  # :reboot is a reserved word, so it is fine to call :reboot
212
212
  else
213
213
  # 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::deployment_routines.select { |r| r.name == c[:command].to_s }.size > 0
214
+ 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
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
@@ -278,11 +284,16 @@ module BlackStack
278
284
  end
279
285
  end
280
286
  end
287
+ #puts
288
+ #puts
289
+ #puts "command: #{self.command}"
290
+ #puts "h[:background] = #{h[:background]}"
281
291
  if h.has_key?(:background)
282
292
  self.background = h[:background]
283
293
  else
284
294
  self.background = false
285
- end
295
+ end
296
+ #puts "self.background = #{self.background}"
286
297
  end # def initialize(h)
287
298
 
288
299
  def to_hash
@@ -305,6 +316,9 @@ module BlackStack
305
316
  # some parameters like `:show_outut` or `:background`.
306
317
  def code(node)
307
318
  ret = self.command
319
+ #puts
320
+ #puts
321
+ #puts "self.command: #{self.command}"
308
322
  # replacing parameters
309
323
  ret.scan(/%[a-zA-Z0-9\_]+%/).each do |p|
310
324
  if p == '%eth0_ip%' # reserved parameter
@@ -314,15 +328,24 @@ module BlackStack
314
328
  # TODO: move this to a timestamp function on blackstack-core
315
329
  ret.gsub!(p, Time.now.to_s.gsub(/\D/, ''))
316
330
  else
331
+ #puts
332
+ #puts
333
+ #puts "p: #{p}"
317
334
  if node.parameters.has_key?(p.gsub(/%/, '').to_sym)
318
335
  ret.gsub!(p, node.parameters[p.gsub(/%/, '').to_sym].to_s)
319
336
  else
320
337
  raise "The parameter #{p} does not exist in the node descriptor #{node.parameters.to_s}"
321
338
  end
339
+ #puts
340
+ #puts
341
+ #puts "ret: #{ret}"
322
342
  end
323
343
  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
344
+ # if the command is configured to run in background, then modify the ret to run in background.
345
+ # note: even if you the flag show_ouput is on, you won't see any error message.
346
+ #puts
347
+ #puts "self.background: #{self.background.to_s}"
348
+ if self.background #&& !BlackStack::Deployer.show_output
326
349
  lines = ret.strip.lines
327
350
  total = lines.size
328
351
  i = 0
@@ -339,6 +362,19 @@ module BlackStack
339
362
  # apply modifications due the sudo flag
340
363
  # return the code
341
364
  ret = node.code(ret, self.sudo)
365
+ #puts
366
+ #puts
367
+ #puts 'lalala'
368
+ #puts ret
369
+ =begin
370
+ if self.sudo
371
+ if node.using_password?
372
+ ret = "echo '#{node.ssh_password.gsub(/'/, "\\\\'")}' | sudo -S su root -c '#{ret}'"
373
+ elsif node.using_private_key_file?
374
+ ret = "sudo -S su root -c '#{ret}'"
375
+ end
376
+ end
377
+ =end
342
378
  # return
343
379
  ret
344
380
  end
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.19
4
+ version: 1.2.22
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-08 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