kameleon-builder 2.9.0 → 2.9.1
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/.bumpversion.cfg +1 -1
- data/CHANGES +5 -0
- data/lib/kameleon/context.rb +3 -3
- data/lib/kameleon/engine.rb +38 -31
- data/version.txt +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b11eb6024451e8df957feaa54ba6f655569dd54
|
4
|
+
data.tar.gz: 5f903059a1e2dd4cb01ea11d91fdcfa885b4bfa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 773ff3b250101855bc17abf0e468486a63642675d68463e2c7ac9f8b73663124cb34a6eaf2205856847c6b44f54f3c963168096bf45f2aaface7bbb5ee124dea
|
7
|
+
data.tar.gz: 5a108c1268d2d40737e4744091e546a8db14bd581f9fdcfbdce382374efde9e19a110f45b7628325697149f7f823b753ab9673fc59ec438666ec50fdcafeeefc
|
data/.bumpversion.cfg
CHANGED
data/CHANGES
CHANGED
data/lib/kameleon/context.rb
CHANGED
@@ -88,7 +88,7 @@ module Kameleon
|
|
88
88
|
raise ContextClosed, "The ctx '#{name}' was closed"
|
89
89
|
end
|
90
90
|
|
91
|
-
def pipe(cmd, other_cmd, other_ctx)
|
91
|
+
def pipe(cmd, other_cmd, other_ctx, kwargs = {})
|
92
92
|
if @cache.mode == :from then
|
93
93
|
Kameleon.ui.info("Redirecting pipe into cache")
|
94
94
|
tmp = @cache.get_cache_cmd(cmd)
|
@@ -96,7 +96,7 @@ module Kameleon
|
|
96
96
|
tmp = Tempfile.new("pipe-#{ Kameleon::Utils.generate_slug(cmd)[0..20] }")
|
97
97
|
Kameleon.ui.verbose("Running piped commands")
|
98
98
|
Kameleon.ui.verbose("Saving STDOUT from #{@name}_ctx to local file #{tmp.path}")
|
99
|
-
execute(cmd, :stdout => tmp)
|
99
|
+
execute(cmd, kwargs.merge({:stdout => tmp}))
|
100
100
|
tmp.close
|
101
101
|
end
|
102
102
|
## Saving one side of the pipe into the cache
|
@@ -108,7 +108,7 @@ module Kameleon
|
|
108
108
|
dest_pipe_path = "${KAMELEON_WORKDIR}/pipe-#{ Kameleon::Utils.generate_slug(other_cmd)[0..20] }"
|
109
109
|
other_ctx.send_file(tmp.path, dest_pipe_path)
|
110
110
|
other_cmd_with_pipe = "cat #{dest_pipe_path} | #{other_cmd} && rm #{dest_pipe_path}"
|
111
|
-
other_ctx.execute(other_cmd_with_pipe)
|
111
|
+
other_ctx.execute(other_cmd_with_pipe, kwargs)
|
112
112
|
end
|
113
113
|
|
114
114
|
def load_shell()
|
data/lib/kameleon/engine.rb
CHANGED
@@ -270,46 +270,59 @@ module Kameleon
|
|
270
270
|
else
|
271
271
|
map[context].reload
|
272
272
|
end
|
273
|
-
when "exec_in"
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
273
|
+
when "exec_in", "exec_out", "exec_local"
|
274
|
+
if kwargs[:only_with_context] and map[cmd.key].closed?
|
275
|
+
Kameleon.ui.debug("Not executing #{cmd.key} command (context closed): #{cmd.value}")
|
276
|
+
else
|
277
|
+
map[cmd.key].execute(cmd.value, kwargs)
|
278
|
+
end
|
279
279
|
when "pipe"
|
280
280
|
first_cmd, second_cmd = cmd.value
|
281
281
|
expected_cmds = ["exec_in", "exec_out", "exec_local"]
|
282
|
+
execute = true
|
282
283
|
[first_cmd.key, second_cmd.key].each do |key|
|
283
284
|
unless expected_cmds.include?(key)
|
284
285
|
Kameleon.ui.error("Invalid pipe arguments. Expected : "\
|
285
286
|
"#{expected_cmds}")
|
286
287
|
fail ExecError
|
287
288
|
end
|
289
|
+
if kwargs[:only_with_context] and map[key].closed?
|
290
|
+
Kameleon.ui.debug("Not executing pipe command (context closed sub command #{key})")
|
291
|
+
execute = false
|
292
|
+
end
|
293
|
+
end
|
294
|
+
if execute
|
295
|
+
first_context = map[first_cmd.key]
|
296
|
+
second_context = map[second_cmd.key]
|
297
|
+
@cache.cache_cmd_raw(cmd.raw_cmd_id) if @cache
|
298
|
+
first_context.pipe(first_cmd.value, second_cmd.value, second_context, kwargs)
|
288
299
|
end
|
289
|
-
first_context = map[first_cmd.key]
|
290
|
-
second_context = map[second_cmd.key]
|
291
|
-
@cache.cache_cmd_raw(cmd.raw_cmd_id) if @cache
|
292
|
-
first_context.pipe(first_cmd.value, second_cmd.value, second_context)
|
293
300
|
when "rescue"
|
294
301
|
first_cmd, second_cmd = cmd.value
|
295
302
|
begin
|
296
|
-
exec_cmd(first_cmd)
|
303
|
+
exec_cmd(first_cmd, kwargs)
|
297
304
|
rescue ExecError
|
298
|
-
safe_exec_cmd(second_cmd)
|
305
|
+
safe_exec_cmd(second_cmd, kwargs)
|
299
306
|
end
|
300
307
|
when "test"
|
301
308
|
first_cmd, second_cmd, third_cmd = cmd.value
|
302
309
|
begin
|
303
|
-
|
310
|
+
Kameleon.ui.debug("Execute test condition")
|
311
|
+
# Drop any :only_with_context flag, so that "if" fails if a closed
|
312
|
+
# context exception occurs. In that case, the "else" statement must
|
313
|
+
# be executed rather than the "then" statement.
|
314
|
+
exec_cmd(first_cmd, kwargs.reject {|k| k == :only_with_context})
|
304
315
|
rescue ExecError
|
305
|
-
|
316
|
+
Kameleon.ui.debug("Execute test 'else' statment'")
|
317
|
+
exec_cmd(third_cmd, kwargs) unless third_cmd.nil?
|
306
318
|
else
|
307
|
-
|
319
|
+
Kameleon.ui.debug("Execute test 'then' statment'")
|
320
|
+
exec_cmd(second_cmd, kwargs)
|
308
321
|
end
|
309
322
|
when "group"
|
310
323
|
cmds = cmd.value
|
311
324
|
cmds.each do |cmd|
|
312
|
-
|
325
|
+
exec_cmd(cmd, kwargs)
|
313
326
|
end
|
314
327
|
else
|
315
328
|
Kameleon.ui.warn("Unknown command : #{cmd.key}")
|
@@ -379,18 +392,14 @@ module Kameleon
|
|
379
392
|
end
|
380
393
|
|
381
394
|
def clean(kwargs = {})
|
382
|
-
|
383
|
-
"exec_out" => @out_context,
|
384
|
-
"exec_local" => @local_context}
|
395
|
+
kwargs = kwargs.merge({:only_with_context => true})
|
385
396
|
if kwargs.fetch(:with_checkpoint, false)
|
386
397
|
Kameleon.ui.info("Removing all checkpoints")
|
387
398
|
@recipe.checkpoint["clear"].each do |cmd|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
Kameleon.ui.warn("An error occurred while executing : #{cmd.value}")
|
393
|
-
end
|
399
|
+
begin
|
400
|
+
exec_cmd(cmd, kwargs)
|
401
|
+
rescue
|
402
|
+
Kameleon.ui.warn("An error occurred while executing : #{cmd.value}")
|
394
403
|
end
|
395
404
|
end
|
396
405
|
end
|
@@ -404,12 +413,10 @@ module Kameleon
|
|
404
413
|
end
|
405
414
|
end
|
406
415
|
microstep.commands.each do |cmd|
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
Kameleon.ui.warn("An error occurred while executing : #{cmd.value}")
|
412
|
-
end
|
416
|
+
begin
|
417
|
+
exec_cmd(cmd, kwargs)
|
418
|
+
rescue
|
419
|
+
Kameleon.ui.warn("An error occurred while executing : #{cmd.value}")
|
413
420
|
end
|
414
421
|
end
|
415
422
|
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.9.
|
1
|
+
2.9.1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kameleon-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salem Harrache
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2018-01-28 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: childprocess
|
@@ -223,7 +223,7 @@ requirements:
|
|
223
223
|
- polipo 1.0.3, or greater
|
224
224
|
- graphviz 2.38.0 or greater
|
225
225
|
rubyforge_project:
|
226
|
-
rubygems_version: 2.5.2
|
226
|
+
rubygems_version: 2.5.2.1
|
227
227
|
signing_key:
|
228
228
|
specification_version: 4
|
229
229
|
summary: Kameleon is a tool to build virtual machines from scratch
|