kafo 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 831fee1d8773e349d7967d6b8e2197cb017d30b0
4
- data.tar.gz: 46c3bc4a21f25b8d8f5f70c18d6d3730dd22f10d
3
+ metadata.gz: 619bbc3ca7bf0903d275c18afa0541c59cc42dc4
4
+ data.tar.gz: 23943836e1d29c01b69217e73ec2f4c26e1e9ab3
5
5
  SHA512:
6
- metadata.gz: e5aa20ffadf4cbf9f0942bab11aa7382611b07b3150de7887caa0a3d16f25aa86cdb5431c4598c63370c6788d6d0cb6ece3ed965fbc1d040a2872539b598629d
7
- data.tar.gz: cec32896880413196709850e0480b72f26c3807f07a7a1bea0794ddf590f3d617bb38de2c9757a961dcd5e64cc7d028058b48aa9d9a33a164733da36edeb3e64
6
+ metadata.gz: 0541b1cef27dfbb2b564f69eac183031b24204fc50a52fc83f61cb3b4c3429a8001fa3716fa3bbe2c7bcc019136cd2f035b2da7e4f649f42e1721fef6c2efbe0
7
+ data.tar.gz: b1de2aabd4201aee9db9f2665598cab7bae50534dd9e46ca6a916dca60e689f23f46bb084ed37ad2e5b970451980349a835816171b19f92f46a4d53bd33bef3c
data/README.md CHANGED
@@ -314,7 +314,7 @@ provided by Kafo can be used and customized to satisfy your needs
314
314
 
315
315
  ### Scenario as an installer plugin
316
316
 
317
- Scenarios were designed to make it possible to package them separately as optional installer extension.
317
+ Scenarios were designed to make it possible to package them separately as optional installer extension.
318
318
  Config files are located in separate directory which makes packaging of additional scenarios easy.
319
319
  Configuration of paths to modules, checks and hooks accepts multiple directories
320
320
  so it is possible to bundle your scenario with additional modules, hooks and checks.
@@ -325,7 +325,7 @@ As your project grows you may need to change your installer modules or add new o
325
325
  Kafo has support for scenario migrations. Migrations are ruby scripts similar to hooks and are located
326
326
  in `<config>/installer-scenarios.d/your-scenario.migrations/` so each scenario has its own set of independent migrations.
327
327
  During its initialization the installer checks for migrations that were not applied yet. It happens exactly between execution of `pre-migrations` and `boot` hooks.
328
- The installer stores names of applied migrations in `<config>/installer-scenarios.d/your-scenario.migrations/.applied` to avoid runnig the migrations multiple times.
328
+ The installer stores names of applied migrations in `<config>/installer-scenarios.d/your-scenario.migrations/.applied` to avoid runnig the migrations multiple times.
329
329
  It is recommended to prefix the migration names with `date +%y%m%d%H%M%S` to avoid migration ordering issues.
330
330
 
331
331
  In a migration you can modify the scenario configuration as well as the answer file. The changed configs are stored immediately after all the migrations were applied.
@@ -965,7 +965,7 @@ not persisted between runs.
965
965
 
966
966
  ## Parser cache
967
967
 
968
- A cache of parsed Puppet modules and manifests can be created to skip the use
968
+ One or more caches of parsed Puppet modules and manifests can be created to skip the use
969
969
  of kafo_parsers at runtime. This is useful when kafo_parsers doesn't support the
970
970
  version of Puppet in use, and may also provide a small performance benefit.
971
971
 
@@ -973,7 +973,13 @@ Create the cache with `kafo-export-params -f parsercache --no-parser-cache` and
973
973
  configure it in config/kafo.yaml with:
974
974
 
975
975
  ```yaml
976
+ # single cache
976
977
  :parser_cache_path: ./parser_cache.yaml
978
+
979
+ # multiple caches
980
+ :parser_cache_path:
981
+ - ./parser_cache.yaml
982
+ - ./another_parser_cache.yaml
977
983
  ```
978
984
 
979
985
  The cache will be skipped if the file modification time of the manifest is
@@ -1028,7 +1034,7 @@ Other exit codes that can be returned:
1028
1034
  * '24' means that your answer file asks for puppet module that you did not provide
1029
1035
  * '25' means that kafo could not get default values from puppet
1030
1036
  * '26' means that kafo could not find the specified scenario
1031
- * '27' means that kafo found found scenario configuration error that prevents installation from continuing
1037
+ * '27' means that kafo found found scenario configuration error that prevents installation from continuing
1032
1038
  * '130' user interrupt (^C)
1033
1039
 
1034
1040
  ## Running Puppet Profiling
@@ -16,8 +16,10 @@
16
16
  # :module_dirs: /usr/share/kafo/modules
17
17
  # Similar as modules_dir but for kafo internal modules, leave nil if you don't need to change it
18
18
  # :kafo_modules_dir:
19
- # Location of an optional cache of parsed module data, generate with kafo-export-params -f parsercache
20
- # :parser_cache_path: /usr/share/kafo/parser_cache.yaml
19
+ # Location of one or more optional caches of parsed module data, generate with kafo-export-params -f parsercache
20
+ # :parser_cache_path:
21
+ # - /usr/share/kafo/parser_cache.yaml
22
+ # - /usr/share/kafo/another_parser_cache.yaml
21
23
  # Enable colors? If you don't touch this, we'll autodetect terminal capabilities
22
24
  # :colors: true
23
25
  # Color scheme, we support :bright and :dark (first is better for white background, dark for black background)
@@ -16,7 +16,7 @@ module Kafo
16
16
  :no_answer_file => 23,
17
17
  :unknown_module => 24,
18
18
  :defaults_error => 25,
19
- :unknown_scenario => 26,
19
+ :unset_scenario => 26,
20
20
  :scenario_error => 27
21
21
  }
22
22
  end
@@ -1,24 +1,35 @@
1
1
  module Kafo
2
2
  class ParserCacheReader
3
- def self.new_from_file(cache_path)
4
- if cache_path.nil? || cache_path.empty?
5
- logger.debug "No parser cache configured in :parser_cache_path, skipping setup"
3
+ def self.new_from_file(cache_paths)
4
+ cache_paths = [cache_paths].compact unless cache_paths.is_a?(Array)
5
+ if cache_paths.empty?
6
+ logger.debug "No parser cache(s) configured in :parser_cache_path, skipping setup"
6
7
  return nil
7
8
  end
8
9
 
9
- unless File.exist?(cache_path)
10
- logger.warn "Parser cache configured at #{cache_path} is missing, skipping setup"
10
+ non_existent = cache_paths.select { |path| !File.exist?(path) }
11
+ unless non_existent.empty?
12
+ logger.warn "Parser cache(s) configured at #{non_existent.join(", ")} are missing, skipping setup"
11
13
  return nil
12
14
  end
13
15
 
14
- parsed = YAML.load(File.read(cache_path))
15
- if !parsed.is_a?(Hash) || parsed[:version] != 1 || !parsed[:files].is_a?(Hash)
16
- logger.warn "Parser cache is from a different version of Kafo, skipping setup"
17
- return nil
16
+ parsed = cache_paths.map { |path| YAML.load(File.read(path)) }
17
+
18
+ parsed.each_with_index do |cache, i|
19
+ if !cache.is_a?(Hash) || cache[:version] != PARSER_CACHE_VERSION || !cache[:files].is_a?(Hash)
20
+ logger.warn "Parser cache #{cache_paths[i]} is from a different version of Kafo, skipping setup"
21
+ return nil
22
+ end
18
23
  end
19
24
 
20
- logger.debug "Using #{cache_path} cache with parsed modules"
21
- new(parsed)
25
+ logger.debug "Using #{cache_paths.join(", ")} cache with parsed modules"
26
+
27
+ merged_cache = {
28
+ :version => PARSER_CACHE_VERSION,
29
+ :files => parsed.map { |cache| cache[:files] }.reduce({}) { |ret, files| ret.merge!(files) }
30
+ }
31
+
32
+ new(merged_cache)
22
33
  end
23
34
 
24
35
  def self.logger
@@ -82,7 +82,7 @@ module Kafo
82
82
  if parsed
83
83
  scenario_file = File.join(config_dir, "#{parsed[3]}.yaml")
84
84
  return scenario_file if File.exists?(scenario_file)
85
- fail_now("Scenario (#{scenario_file}) was not found, can not continue", :unknown_scenario)
85
+ fail_now("Scenario (#{scenario_file}) was not found, can not continue", :unset_scenario)
86
86
  end
87
87
  end
88
88
 
@@ -93,7 +93,7 @@ module Kafo
93
93
  if scenario.nil?
94
94
  fail_now("No installation scenario was selected, the installer can not continue.\n" +
95
95
  " Even --help content is dependent on selected scenario.\n" +
96
- " Select scenario with --scenario SCENARIO or list available scenarios with --list-scenarios.", :unknown_scenario)
96
+ " Select scenario with --scenario SCENARIO or list available scenarios with --list-scenarios.", :unset_scenario)
97
97
  elsif !scenario_enabled?(scenario)
98
98
  fail_now("Selected scenario is DISABLED, can not continue.\n" +
99
99
  " Use --list-scenarios to list available options.\n" +
data/lib/kafo/version.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # encoding: UTF-8
2
2
  module Kafo
3
- VERSION = "0.9.2"
3
+ PARSER_CACHE_VERSION = 1
4
+ VERSION = "0.9.3"
4
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler