kameleon-builder 2.7.2 → 2.7.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a2c9644b602c1fe67b1fcab541b004d3695392bb
4
+ data.tar.gz: e1df98ecaf104f722a5dfd2cad453b353b83ae40
5
+ SHA512:
6
+ metadata.gz: 28137867258f3f264da34dec74181369976a54cdfd9cf4c92e1fa0ea3cce55af0f90bfb6f07045944ee65ee4702948f4f570a38279087fb19b57c04b9b0c4821
7
+ data.tar.gz: db96df44109150bfb4f4eabecfa5d44c6655c3a0149f65338c585d03f401e40583d5e34d563718ef6072fbdf209b5900aee3f464f513b985c028ec8fa469d872
data/.bumpversion.cfg CHANGED
@@ -1,7 +1,7 @@
1
1
  [bumpversion]
2
2
  commit = True
3
3
  tag = True
4
- current_version = 2.7.2
4
+ current_version = 2.7.3
5
5
  parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+))?
6
6
  serialize =
7
7
  {major}.{minor}.{patch}.{release}
data/CHANGES CHANGED
@@ -1,6 +1,16 @@
1
1
  Kameleon CHANGELOG
2
2
  ==================
3
3
 
4
+ Version 2.7.3
5
+ -------------
6
+
7
+ Released on June 20th 2016
8
+
9
+ - The info command can now handle multiple recipes
10
+ - Colorized the output of the info command
11
+ - Added the dryrun option to the info command
12
+ - Added the dag option to the info command: draw a GraphViz dag for recipes
13
+
4
14
  Version 2.7.2
5
15
  -------------
6
16
 
data/RELEASING.rst ADDED
@@ -0,0 +1,21 @@
1
+ You can use the script ``./scripts/bumpversion.py`` which will handle
2
+ everything (incrementation, git tag creation, changelog update).
3
+ First you need to install bumpversion using pip::
4
+
5
+ sudo pip2 install bumpversion
6
+
7
+ Then for the actual releasing:
8
+
9
+ 1) After each release, a new version has to be created (in this example, the 2.7.0 dev)::
10
+
11
+ python2 ./scripts/bumpversion.py newversion minor # 2.6.7 -> 2.7.0.dev
12
+
13
+ 2) [work/commit]
14
+
15
+ 3) Releasing a new version::
16
+
17
+ python2 ./scripts/bumpversion.py release # 2.7.0.dev -> 2.7.0 + git tag + changelog
18
+ gem build kameleon-builder.gemspec
19
+ gem push kameleon-builder-2.7.0.gem
20
+
21
+ You need a rubygem account and I have to give you permissions so that you can push.
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.description = %q{The mindful appliance builder}
21
21
  s.summary = %q{Kameleon is a tool to build virtual machines from scratch}
22
22
  s.homepage = 'http://kameleon.imag.fr/'
23
- s.license = 'GPL-2'
23
+ s.license = 'GPL-2.0'
24
24
 
25
25
  s.files = `git ls-files`.split($/)
26
26
  s.files.reject! { |file| file.start_with?('docs/') }
@@ -30,7 +30,9 @@ Gem::Specification.new do |s|
30
30
 
31
31
  s.add_dependency 'childprocess', '~> 0.5.3', '>= 0.3.0'
32
32
  s.add_dependency 'thor', '~> 0.19', '>= 0.15.0'
33
- s.add_dependency 'table_print', '~> 1.5.2'
33
+ s.add_dependency 'table_print', '~> 1.5'
34
+ s.add_dependency 'psych', '~> 2.0'
35
+ s.add_dependency 'ruby-graphviz', '~> 1.2'
34
36
 
35
- s.requirements = ['polipo 1.0.3, or greater']
37
+ s.requirements = ['polipo 1.0.3, or greater', 'graphviz 2.38.0 or greater']
36
38
  end
data/lib/kameleon/cli.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'kameleon/engine'
2
2
  require 'kameleon/recipe'
3
3
  require 'kameleon/utils'
4
+ require 'tempfile'
5
+ require 'graphviz'
4
6
 
5
7
  module Kameleon
6
8
 
@@ -82,7 +84,7 @@ module Kameleon
82
84
  end
83
85
  tpl = RecipeTemplate.new(template_path)
84
86
  tpl.resolve! :strict => false
85
- tpl.display_info
87
+ tpl.display_info(false)
86
88
  end
87
89
  map %w(-h --help) => :help
88
90
  map %w(ls) => :list
@@ -170,16 +172,30 @@ module Kameleon
170
172
  end
171
173
  end
172
174
 
173
- desc "info [[RECIPE_PATH]]", "Display detailed information about a recipe"
175
+ desc "info [RECIPE_PATH]", "Display detailed information about a recipe"
174
176
  method_option :global, :type => :hash ,
175
177
  :default => {}, :aliases => "-g",
176
178
  :desc => "Set custom global variables."
177
179
  method_option :from_cache, :type => :string ,
178
180
  :default => nil,
179
181
  :desc => "Get info from a persistent cache tar file (ignore recipe path)"
182
+ method_option :dryrun, :type => :boolean ,
183
+ :default => false,
184
+ :desc => "Show the build sequence but do not actually build"
185
+ method_option :dag, :type => :boolean ,
186
+ :default => false,
187
+ :desc => "Show a DAG of the build sequence"
188
+ method_option :file, :type => :string ,
189
+ :default => "/tmp/kameleon.dag",
190
+ :desc => "DAG output filename"
191
+ method_option :format, :type => :string ,
192
+ :desc => "DAG GraphViz format"
193
+ method_option :relative, :type => :boolean ,
194
+ :default => false,
195
+ :desc => "Make pathnames relative to the current working directory"
180
196
 
181
- def info(recipe_path=nil)
182
- if recipe_path.nil? && !options[:from_cache].nil?
197
+ def info(*recipe_paths)
198
+ if recipe_paths.length == 0 && !options[:from_cache].nil?
183
199
  unless File.file?(options[:from_cache])
184
200
  raise CacheError, "The specified cache file "\
185
201
  "\"#{options[:from_cache]}\" do not exists"
@@ -189,12 +205,40 @@ module Kameleon
189
205
  @cache.cache_path = options[:from_cache]
190
206
  recipe_path = @cache.get_recipe
191
207
  end
192
- recipe = Kameleon::Recipe.new(recipe_path)
193
- recipe.resolve!
194
- recipe.display_info
208
+ dag = nil
209
+ color = 0
210
+ recipe_paths.each do |path|
211
+ recipe = Kameleon::Recipe.new(path)
212
+ if options[:dryrun]
213
+ Kameleon::Engine.new(recipe, options).dryrun
214
+ elsif options[:dag]
215
+ dag = Kameleon::Engine.new(recipe, options).dag(dag, color)
216
+ color += 1
217
+ else
218
+ recipe.display_info(options[:relative])
219
+ end
220
+ end
221
+ if options[:dag]
222
+ format = "canon"
223
+ if options[:format]
224
+ if GraphViz::Constants::FORMATS.include?(options[:format])
225
+ format = options[:format]
226
+ else
227
+ Kameleon.ui.warn("Unknown GraphViz format #{options[:format]}, fall back to #{format}")
228
+ end
229
+ else
230
+ options[:file].match(/^.+\.([^\.]+)$/) do |f|
231
+ if GraphViz::Constants::FORMATS.include?(f[1])
232
+ format = f[1]
233
+ end
234
+ end
235
+ end
236
+ dag.output( :"#{format}" => options[:file] )
237
+ Kameleon.ui.info("Generated GraphViz #{format} file: #{options[:file]}")
238
+ end
195
239
  end
196
240
 
197
- desc "build [[RECIPE_PATH]]", "Builds the appliance from the given recipe"
241
+ desc "build [RECIPE_PATH]", "Builds the appliance from the given recipe"
198
242
  method_option :build_path, :type => :string ,
199
243
  :default => nil, :aliases => "-b",
200
244
  :desc => "Sets the build directory path"
@@ -1,6 +1,7 @@
1
1
  require 'kameleon/recipe'
2
2
  require 'kameleon/context'
3
3
  require 'kameleon/persistent_cache'
4
+ require 'graphviz'
4
5
 
5
6
 
6
7
  module Kameleon
@@ -74,15 +75,16 @@ module Kameleon
74
75
  if @options[:enable_cache] || @options[:from_cache] then
75
76
  @cache.recipe_files = @recipe.all_files
76
77
  end
77
-
78
- begin
79
- Kameleon.ui.info("Creating kameleon build directory : #{@cwd}")
80
- FileUtils.mkdir_p @cwd
81
- rescue
82
- raise BuildError, "Failed to create build directory #{@cwd}"
78
+ unless @options[:dryrun] or @options[:dag]
79
+ begin
80
+ Kameleon.ui.info("Creating kameleon build directory : #{@cwd}")
81
+ FileUtils.mkdir_p @cwd
82
+ rescue
83
+ raise BuildError, "Failed to create build directory #{@cwd}"
84
+ end
85
+ @cache.start if @cache
86
+ build_contexts
83
87
  end
84
- @cache.start if @cache
85
- build_contexts
86
88
  end
87
89
 
88
90
  def build_contexts
@@ -403,6 +405,98 @@ module Kameleon
403
405
  @cache.stop_web_proxy if @options[:enable_cache] ## stopping polipo
404
406
  end
405
407
 
408
+ def dryrun
409
+ def relative_or_absolute_path(path)
410
+ if @options[:relative]
411
+ return path.relative_path_from(Pathname(Dir.pwd))
412
+ else
413
+ return path
414
+ end
415
+ end
416
+ Kameleon.ui.shell.say ""
417
+ Kameleon.ui.shell.say "#{ @recipe.name } ", :bold
418
+ Kameleon.ui.shell.say "(#{ relative_or_absolute_path(@recipe.path) })", :cyan
419
+ ["bootstrap", "setup", "export"].each do |section_name|
420
+ section = @recipe.sections.fetch(section_name)
421
+ Kameleon.ui.shell.say "[" << section.name.capitalize << "]", :red
422
+ section.sequence do |macrostep|
423
+ Kameleon.ui.shell.say " "
424
+ Kameleon.ui.shell.say "#{macrostep.name} ", :bold
425
+ if macrostep.path
426
+ Kameleon.ui.shell.say "(#{ relative_or_absolute_path(macrostep.path) })", :cyan
427
+ else
428
+ Kameleon.ui.shell.say "(internal)", :cyan
429
+ end
430
+ macrostep.sequence do |microstep|
431
+ Kameleon.ui.shell.say " --> ", :magenta
432
+ Kameleon.ui.shell.say "#{ microstep.order } ", :green
433
+ Kameleon.ui.shell.say "#{ microstep.name }", :yellow
434
+ end
435
+ end
436
+ end
437
+ Kameleon.ui.shell.say ""
438
+ end
439
+
440
+ def dag(graph, color)
441
+ if graph.nil?
442
+ graph = GraphViz::new( "G" )
443
+ end
444
+ recipe_path = @recipe.path.relative_path_from(Pathname(Dir.pwd)).to_s
445
+ colorscheme = "set18"
446
+ color = (color % 8 + 1).to_s
447
+ g_recipes = graph.add_graph( "cluster R:recipes" )
448
+ g_recipes['label'] = 'Recipes'
449
+ g_recipes['style'] = 'dashed'
450
+ n_recipe = g_recipes.add_nodes(recipe_path)
451
+ n_recipe['label'] = recipe_path
452
+ n_recipe['shape'] = 'Mdiamond'
453
+ n_recipe['colorscheme'] = colorscheme
454
+ n_recipe['color'] = color
455
+ (@recipe.base_recipes_files - [@recipe.path]).uniq.each do |base_recipe_path|
456
+ n_base_recipe = g_recipes.add_nodes(base_recipe_path.relative_path_from(Pathname(Dir.pwd)).to_s)
457
+ n_base_recipe['shape'] = 'Mdiamond'
458
+ edge = graph.add_edges(n_base_recipe, n_recipe)
459
+ edge['style'] = 'dashed'
460
+ end
461
+ n_prev = n_recipe
462
+ ["bootstrap", "setup", "export"].each do |section_name|
463
+ section = @recipe.sections.fetch(section_name)
464
+ g_section = graph.add_graph( "cluster S:#{ section_name }" )
465
+ g_section['label'] = section_name.capitalize
466
+ section.sequence do |macrostep|
467
+ if macrostep.path.nil?
468
+ macrostep_name = macrostep.name
469
+ else
470
+ macrostep_name = macrostep.path.relative_path_from(Pathname(Dir.pwd)).to_s
471
+ macrostep_name.chomp!(".yaml")
472
+ macrostep_name.sub!(/^steps\//, "")
473
+ end
474
+ g_macrostep = g_section.add_graph( "cluster M:#{ macrostep_name }")
475
+ g_macrostep['label'] = macrostep_name
476
+ g_macrostep['style'] = 'filled'
477
+ g_macrostep['color'] = 'gray'
478
+ macrostep.sequence do |microstep|
479
+ n_microstep = g_macrostep.add_nodes("m:#{macrostep_name}/#{microstep.name}")
480
+ n_microstep['label'] = microstep.name
481
+ n_microstep['style'] = 'filled'
482
+ n_microstep['color'] = 'white'
483
+ edge = graph.add_edges(n_prev, n_microstep)
484
+ edge['colorscheme'] = colorscheme
485
+ edge['color'] = color
486
+ n_prev = n_microstep
487
+ end
488
+ end
489
+ end
490
+ n_end = graph.add_nodes('end')
491
+ n_end['label'] = 'END'
492
+ n_end['shape'] = 'Msquare'
493
+ edge = graph.add_edges(n_prev, n_end)
494
+ edge['colorscheme'] = colorscheme
495
+ edge['color'] = color
496
+ Kameleon.ui.info "-> Drawn DAG for #{recipe_path}"
497
+ return graph
498
+ end
499
+
406
500
  def build
407
501
  if @enable_checkpoint
408
502
  @from_checkpoint = @options[:from_checkpoint]
@@ -21,6 +21,9 @@ module Kameleon
21
21
 
22
22
  def initialize(path, kwargs = {})
23
23
  @path = Pathname.new(File.expand_path(path))
24
+ if not @path.exist? and @path.extname != ".yaml"
25
+ @path = Pathname.new(File.expand_path(path + ".yaml"))
26
+ end
24
27
  @name = (@path.basename ".yaml").to_s
25
28
  @recipe_content = File.open(@path, 'r') { |f| f.read }
26
29
  @sections = {
@@ -90,7 +93,7 @@ module Kameleon
90
93
 
91
94
  update_steps_dirs()
92
95
 
93
- # Load entended recipe variables
96
+ # Load extended recipe variables
94
97
  yaml_recipe = load_base_recipe(yaml_recipe, @path)
95
98
  yaml_recipe.delete("extend")
96
99
 
@@ -775,34 +778,45 @@ module Kameleon
775
778
  return recipe_hash
776
779
  end
777
780
 
778
- def display_info
781
+ def display_info(do_relative_path)
779
782
  def prefix
780
- Kameleon.ui.shell.say " -> ", :blue
783
+ Kameleon.ui.shell.say " -> ", :magenta
784
+ end
785
+ def relative_or_absolute_path(do_relative_path, path)
786
+ if do_relative_path
787
+ return path.relative_path_from(Pathname(Dir.pwd))
788
+ else
789
+ return path
790
+ end
781
791
  end
782
- Kameleon.ui.info("Description:")
783
- prefix ; Kameleon.ui.info("#{@metainfo['description']}")
784
- Kameleon.ui.info("Path:")
785
- prefix ; Kameleon.ui.info("#{@path}")
786
- Kameleon.ui.info("Parent recipes:")
792
+ Kameleon.ui.shell.say
793
+ Kameleon.ui.shell.say "[Name]", :red
794
+ prefix ; Kameleon.ui.shell.say "#{@name}"
795
+ Kameleon.ui.shell.say "[Path]", :red
796
+ prefix ; Kameleon.ui.shell.say relative_or_absolute_path(do_relative_path, @path), :cyan
797
+ Kameleon.ui.shell.say "[Description]", :red
798
+ prefix ; Kameleon.ui.shell.say "#{@metainfo['description']}"
799
+ Kameleon.ui.shell.say "[Parent recipes]", :red
787
800
  (@base_recipes_files - [@path]).each do |base_recipe_file|
788
- prefix ; Kameleon.ui.info("#{base_recipe_file}")
801
+ prefix ; Kameleon.ui.shell.say relative_or_absolute_path(do_relative_path, base_recipe_file), :cyan
789
802
  end
790
- Kameleon.ui.info("Steps:")
803
+ Kameleon.ui.shell.say "[Steps]", :red
791
804
  @step_files.each do |step|
792
- prefix ; Kameleon.ui.info("#{step}")
805
+ prefix ; Kameleon.ui.shell.say relative_or_absolute_path(do_relative_path, step), :cyan
793
806
  end
794
- Kameleon.ui.info("Data:")
807
+ Kameleon.ui.shell.say "[Data]", :red
795
808
  @data_files.each do |d|
796
- prefix ; Kameleon.ui.info("#{d}")
809
+ prefix ; Kameleon.ui.shell.say relative_or_absolute_path(do_relative_path, d), :cyan
797
810
  end
798
- Kameleon.ui.info("Environment scripts:")
811
+ Kameleon.ui.shell.say "[Environment scripts]", :red
799
812
  @env_files.each do |d|
800
- prefix ; Kameleon.ui.info("#{d}")
813
+ prefix ; Kameleon.ui.shell.say relative_or_absolute_path(do_relative_path, d), :cyan
801
814
  end
802
- Kameleon.ui.info("Variables:")
815
+ Kameleon.ui.shell.say "[Variables]", :red
803
816
  @global.sort.map do |key, value|
804
817
  value = "\n" if value.to_s.empty?
805
- prefix ; Kameleon.ui.info("#{key}: #{value}")
818
+ prefix ; Kameleon.ui.shell.say "#{key}: ", :yellow
819
+ Kameleon.ui.shell.say "#{value}"
806
820
  end
807
821
  end
808
822
 
data/lib/kameleon/step.rb CHANGED
@@ -37,6 +37,7 @@ module Kameleon
37
37
 
38
38
  def value
39
39
  if @value.nil?
40
+ Kameleon.ui.debug("Parsed string = #{@string_cmd}")
40
41
  object = YAML.load(@string_cmd)
41
42
  if object.kind_of? Command
42
43
  @value = object
@@ -58,10 +59,9 @@ module Kameleon
58
59
  end
59
60
  @value
60
61
  rescue
61
- lines = YAML.dump(object).gsub("---", "").strip
62
- lines = lines.split( /\r?\n/ ).map {|l| "> #{l}" }
63
- fail RecipeError, "Syntax error for microstep #{@microstep_name} : \n"\
64
- "#{ lines.join "\n"}"
62
+ fail RecipeError, "Syntax error after variable resolution for microstep #{@microstep_name}, parsed string =\n"\
63
+ "#{@string_cmd}\n"\
64
+ "Maybe you should remove trailing newline from variable using '>-' or '|-'"
65
65
  end
66
66
 
67
67
  def to_array
@@ -1,6 +1,14 @@
1
1
  module Kameleon
2
2
  module Utils
3
3
 
4
+ @@warned_vars = Array.new
5
+ def self.warn_var(var)
6
+ if ! @@warned_vars.include?(var)
7
+ Kameleon.ui.warn("Warning : variable $$#{var[0]} is not enclosed with braces, which may cause errors. Please prefer using $${#{var[0]}}.")
8
+ @@warned_vars.push(var)
9
+ end
10
+ end
11
+
4
12
 
5
13
  def self.resolve_vars(raw, yaml_path, initial_variables, recipe, kwargs = {})
6
14
  raw = resolve_data_dir_vars(raw, yaml_path, initial_variables, recipe, kwargs)
@@ -8,6 +16,9 @@ module Kameleon
8
16
  end
9
17
 
10
18
  def self.resolve_data_dir_vars(raw, yaml_path, initial_variables, recipe, kwargs)
19
+ raw.to_s.scan(/\$\$kameleon\_data\_dir\/(.*)/) do |var|
20
+ warn_var(var)
21
+ end
11
22
  reg = %r/\$\$kameleon\_data\_dir\/(.*)|\$\${kameleon\_data\_dir}\/(.*)/
12
23
  matches = raw.to_enum(:scan, reg).map { Regexp.last_match }
13
24
  matches.each do |m|
@@ -21,6 +32,9 @@ module Kameleon
21
32
  end
22
33
 
23
34
  def self.resolve_simple_vars_once(raw, initial_variables)
35
+ raw.to_s.scan(/\$\$([a-zA-Z0-9\-_]+)/) do |var|
36
+ warn_var(var)
37
+ end
24
38
  raw.to_s.gsub(/\$\$\{[a-zA-Z0-9\-_]+\}|\$\$[a-zA-Z0-9\-_]+/) do |var|
25
39
  # remove the dollars
26
40
  if var.include? "{"
@@ -55,6 +69,9 @@ module Kameleon
55
69
 
56
70
 
57
71
  def self.resolve_simple_vars(raw, yaml_path, initial_variables, kwargs)
72
+ raw.to_s.scan(/\$\$([a-zA-Z0-9\-_]+)/) do |var|
73
+ warn_var(var)
74
+ end
58
75
  raw.to_s.gsub(/\$\$\{[a-zA-Z0-9\-_]+\}|\$\$[a-zA-Z0-9\-_]+/) do |var|
59
76
  # remove the dollars
60
77
  if var.include? "{"
@@ -0,0 +1,3 @@
1
+ Warning : variable $$arch is not enclosed with braces, which may cause errors. Please prefer using $${arch}.
2
+ Warning : variable $$arch-live is not enclosed with braces, which may cause errors. Please prefer using $${arch-live}.
3
+ Error : /home/neyron/scm/OAR/kameleon/tests/issue76/fail.yaml: variable $$arch-live not found in local or global
@@ -0,0 +1,10 @@
1
+ global:
2
+ arch: x86_64
3
+ iso_arch: $$arch
4
+ iso_filename: debian-jessie-$${iso_arch}-live.iso
5
+
6
+ bootstrap:
7
+ - testbootstrap:
8
+ - toto: $$arch
9
+ - step:
10
+ - exec_local: echo $iso_filename
@@ -0,0 +1,26 @@
1
+ Starting recipe consistency check
2
+ Resolving variables
3
+ Warning : variable $$iso_filename is not enclosed with braces, which may cause errors. Please prefer using $${iso_filename}.
4
+ Warning : variable $$toto is not enclosed with braces, which may cause errors. Please prefer using $${toto}.
5
+ Warning : variable $$titi is not enclosed with braces, which may cause errors. Please prefer using $${titi}.
6
+ Creating kameleon build directory : /home/neyron/scm/OAR/kameleon/tests/issue76/build/ok
7
+ Starting build recipe 'ok.yaml'
8
+ Step _init_bootstrap took: 0 secs
9
+ Step 1 : bootstrap/testbootstrap/step
10
+ --> Running the step...
11
+ Starting command: "bash"
12
+ [local] The local_context has been initialized
13
+ [local] debian-jessie-x86_64-live.iso x86_64-toto
14
+ Step testbootstrap took: 1 secs
15
+ Step 2 : bootstrap/testbootstrapinline/step
16
+ --> Running the step...
17
+ [local] debian-jessie-x86_64-live.iso
18
+ Step testbootstrapinline took: 0 secs
19
+ Step _clean_bootstrap took: 0 secs
20
+ Step _init_setup took: 0 secs
21
+ Step _clean_setup took: 0 secs
22
+ Step _init_export took: 0 secs
23
+ Step _clean_export took: 0 secs
24
+
25
+ Successfully built 'ok.yaml'
26
+ Total duration : 1 secs
@@ -0,0 +1,11 @@
1
+ global:
2
+ arch: x86_64
3
+ iso_arch: $${arch}
4
+ iso_filename: debian-jessie-$${iso_arch}-live.iso
5
+
6
+ bootstrap:
7
+ - testbootstrap
8
+ - testbootstrapinline:
9
+ - titi: $arch
10
+ - step:
11
+ - exec_local: echo $$iso_filename $$titi
@@ -0,0 +1,3 @@
1
+ - toto: $${arch}-toto
2
+ - step:
3
+ - exec_local: echo $$iso_filename $$toto
@@ -0,0 +1 @@
1
+ This is DATA!!!
@@ -0,0 +1,3 @@
1
+ - my_distrib: $${version}-$${variant}
2
+ - show_variables:
3
+ - exec_local: "echo This is the distrib variable: $${my_distrib}"
@@ -13,7 +13,7 @@ checkpoint: test.yaml
13
13
  #== Global variables use by Kameleon engine and the steps
14
14
  global:
15
15
  ## User varibales : used by the recipe
16
- user_name: kameleon
16
+ user_name: kameleon_user
17
17
  user_password: $$user_name
18
18
 
19
19
  # test overload
@@ -29,7 +29,10 @@ global:
29
29
 
30
30
  bootstrap_packages: >
31
31
  less vim python
32
+ sl sudo
32
33
 
34
+ version: 12.2
35
+ variant: toto-tata
33
36
  #== Bootstrap the new system and create the 'in_context'
34
37
  bootstrap:
35
38
  - enable_something
@@ -38,6 +41,18 @@ bootstrap:
38
41
 
39
42
  setup:
40
43
  - software_install
44
+ - inline_step:
45
+ - do_something:
46
+ - exec_local: >
47
+ echo $${toto} ;\
48
+ echo titi
49
+ - do_something_else:
50
+ - exec_local: |
51
+ echo $$toto $$user_name
52
+ - test_data:
53
+ - exec_local: cat $$kameleon_data_dir/mydata.txt
54
+ - local_variables
55
+
41
56
 
42
57
  export:
43
58
  - save_appliance:
@@ -0,0 +1,13 @@
1
+ extend: test_recipe
2
+
3
+ global:
4
+ mo: mi
5
+ test_override: $${user_name}-override
6
+
7
+ setup:
8
+ - inline_step:
9
+ - do_something_else:
10
+ - exec_local: |
11
+ echo $$toto $$user_name
12
+ echo $$test_override
13
+
@@ -0,0 +1 @@
1
+ This is OVERRIDED DATA!!!
@@ -0,0 +1,7 @@
1
+ extend: ../recipes/test_recipe.yaml
2
+
3
+ setup:
4
+ - "@base"
5
+ - test_data:
6
+ - do_test:
7
+ - exec_local: cat $$kameleon_data_dir/mydata.txt
data/version.txt CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 2.7.3
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kameleon-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.2
5
- prerelease:
4
+ version: 2.7.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Salem Harrache
@@ -13,68 +12,90 @@ authors:
13
12
  autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
- date: 2016-02-17 00:00:00.000000000 Z
15
+ date: 2016-06-20 00:00:00.000000000 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: childprocess
20
19
  requirement: !ruby/object:Gem::Requirement
21
- none: false
22
20
  requirements:
23
- - - ~>
21
+ - - "~>"
24
22
  - !ruby/object:Gem::Version
25
23
  version: 0.5.3
26
- - - ! '>='
24
+ - - ">="
27
25
  - !ruby/object:Gem::Version
28
26
  version: 0.3.0
29
27
  type: :runtime
30
28
  prerelease: false
31
29
  version_requirements: !ruby/object:Gem::Requirement
32
- none: false
33
30
  requirements:
34
- - - ~>
31
+ - - "~>"
35
32
  - !ruby/object:Gem::Version
36
33
  version: 0.5.3
37
- - - ! '>='
34
+ - - ">="
38
35
  - !ruby/object:Gem::Version
39
36
  version: 0.3.0
40
37
  - !ruby/object:Gem::Dependency
41
38
  name: thor
42
39
  requirement: !ruby/object:Gem::Requirement
43
- none: false
44
40
  requirements:
45
- - - ~>
41
+ - - "~>"
46
42
  - !ruby/object:Gem::Version
47
43
  version: '0.19'
48
- - - ! '>='
44
+ - - ">="
49
45
  - !ruby/object:Gem::Version
50
46
  version: 0.15.0
51
47
  type: :runtime
52
48
  prerelease: false
53
49
  version_requirements: !ruby/object:Gem::Requirement
54
- none: false
55
50
  requirements:
56
- - - ~>
51
+ - - "~>"
57
52
  - !ruby/object:Gem::Version
58
53
  version: '0.19'
59
- - - ! '>='
54
+ - - ">="
60
55
  - !ruby/object:Gem::Version
61
56
  version: 0.15.0
62
57
  - !ruby/object:Gem::Dependency
63
58
  name: table_print
64
59
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
60
  requirements:
67
- - - ~>
61
+ - - "~>"
68
62
  - !ruby/object:Gem::Version
69
- version: 1.5.2
63
+ version: '1.5'
70
64
  type: :runtime
71
65
  prerelease: false
72
66
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
67
  requirements:
75
- - - ~>
68
+ - - "~>"
76
69
  - !ruby/object:Gem::Version
77
- version: 1.5.2
70
+ version: '1.5'
71
+ - !ruby/object:Gem::Dependency
72
+ name: psych
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '2.0'
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: '2.0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: ruby-graphviz
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '1.2'
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '1.2'
78
99
  description: The mindful appliance builder
79
100
  email:
80
101
  - salem.harrache@inria.fr
@@ -87,16 +108,16 @@ executables:
87
108
  extensions: []
88
109
  extra_rdoc_files: []
89
110
  files:
90
- - .bumpversion.cfg
91
- - .editorconfig
92
- - .env
93
- - .gitignore
111
+ - ".bumpversion.cfg"
112
+ - ".editorconfig"
113
+ - ".env"
114
+ - ".gitignore"
94
115
  - AUTHORS
95
116
  - CHANGES
96
117
  - COPYING
97
118
  - Gemfile
98
119
  - README.rst
99
- - RELEASING
120
+ - RELEASING.rst
100
121
  - Vagrantfile
101
122
  - bin/kameleon
102
123
  - completion/_kameleon
@@ -156,56 +177,76 @@ files:
156
177
  - lib/kameleon/version.rb
157
178
  - scripts/bumpversion.py
158
179
  - tests/helper.rb
180
+ - tests/issue76/fail.stdout
181
+ - tests/issue76/fail.yaml
182
+ - tests/issue76/ok.stdout
183
+ - tests/issue76/ok.yaml
184
+ - tests/issue76/steps/testbootstrap.yaml
159
185
  - tests/recipes/steps/aliases/defaults.yaml
160
186
  - tests/recipes/steps/bootstrap/linux/bootstrap.yaml
161
187
  - tests/recipes/steps/checkpoints/test.yaml
188
+ - tests/recipes/steps/data/mydata.txt
162
189
  - tests/recipes/steps/enable_something.yaml
163
190
  - tests/recipes/steps/export/save_appliance.yaml
191
+ - tests/recipes/steps/local_variables.yaml
164
192
  - tests/recipes/steps/setup/linux/software_install.yaml
165
193
  - tests/recipes/test_recipe.yaml
194
+ - tests/recipes/test_recipe_child.yaml
195
+ - tests/test2/steps/data/mydata.txt
166
196
  - tests/test2/test2.yaml
167
197
  - tests/test2/test3.yaml
198
+ - tests/test2/test_data.yaml
168
199
  - tests/test_context.rb
169
200
  - tests/test_recipe.rb
170
201
  - tests/test_version.rb
171
202
  - version.txt
172
203
  homepage: http://kameleon.imag.fr/
173
204
  licenses:
174
- - GPL-2
205
+ - GPL-2.0
206
+ metadata: {}
175
207
  post_install_message:
176
208
  rdoc_options: []
177
209
  require_paths:
178
210
  - lib
179
211
  required_ruby_version: !ruby/object:Gem::Requirement
180
- none: false
181
212
  requirements:
182
- - - ! '>='
213
+ - - ">="
183
214
  - !ruby/object:Gem::Version
184
215
  version: '0'
185
216
  required_rubygems_version: !ruby/object:Gem::Requirement
186
- none: false
187
217
  requirements:
188
- - - ! '>='
218
+ - - ">="
189
219
  - !ruby/object:Gem::Version
190
220
  version: '0'
191
221
  requirements:
192
222
  - polipo 1.0.3, or greater
223
+ - graphviz 2.38.0 or greater
193
224
  rubyforge_project:
194
- rubygems_version: 1.8.23.2
225
+ rubygems_version: 2.5.1
195
226
  signing_key:
196
- specification_version: 3
227
+ specification_version: 4
197
228
  summary: Kameleon is a tool to build virtual machines from scratch
198
229
  test_files:
199
230
  - tests/helper.rb
231
+ - tests/issue76/fail.stdout
232
+ - tests/issue76/fail.yaml
233
+ - tests/issue76/ok.stdout
234
+ - tests/issue76/ok.yaml
235
+ - tests/issue76/steps/testbootstrap.yaml
200
236
  - tests/recipes/steps/aliases/defaults.yaml
201
237
  - tests/recipes/steps/bootstrap/linux/bootstrap.yaml
202
238
  - tests/recipes/steps/checkpoints/test.yaml
239
+ - tests/recipes/steps/data/mydata.txt
203
240
  - tests/recipes/steps/enable_something.yaml
204
241
  - tests/recipes/steps/export/save_appliance.yaml
242
+ - tests/recipes/steps/local_variables.yaml
205
243
  - tests/recipes/steps/setup/linux/software_install.yaml
206
244
  - tests/recipes/test_recipe.yaml
245
+ - tests/recipes/test_recipe_child.yaml
246
+ - tests/test2/steps/data/mydata.txt
207
247
  - tests/test2/test2.yaml
208
248
  - tests/test2/test3.yaml
249
+ - tests/test2/test_data.yaml
209
250
  - tests/test_context.rb
210
251
  - tests/test_recipe.rb
211
252
  - tests/test_version.rb
data/RELEASING DELETED
@@ -1,16 +0,0 @@
1
- You can use the script ``./scripts/bumpversion.py`` which will handle
2
- everything (incrementation, git tag creation, changelog update).
3
-
4
- 1) After each release, a new version has to be created (in this example, the 2.7.0 dev)
5
-
6
- $ python2 ./scripts/bumpversion.py newversion minor # 2.6.7 -> 2.7.0.dev
7
-
8
- [work/commit]
9
-
10
- 2) Releasing a new version
11
-
12
- $ python2 ./scripts/bumpversion.py release # 2.7.0.dev -> 2.7.0 + git tag + changelog
13
- $ gem build kameleon-builder.gemspec
14
- $ gem push kameleon-builder-2.7.0.gem
15
-
16
- You need a rubygem account and I have to give you permissions so that you can push