kafo 0.9.2 → 0.9.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 +4 -4
- data/README.md +10 -4
- data/config/kafo.yaml.example +4 -2
- data/lib/kafo/exit_handler.rb +1 -1
- data/lib/kafo/parser_cache_reader.rb +22 -11
- data/lib/kafo/scenario_manager.rb +2 -2
- data/lib/kafo/version.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 619bbc3ca7bf0903d275c18afa0541c59cc42dc4
|
4
|
+
data.tar.gz: 23943836e1d29c01b69217e73ec2f4c26e1e9ab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
data/config/kafo.yaml.example
CHANGED
@@ -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
|
20
|
-
# :parser_cache_path:
|
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)
|
data/lib/kafo/exit_handler.rb
CHANGED
@@ -1,24 +1,35 @@
|
|
1
1
|
module Kafo
|
2
2
|
class ParserCacheReader
|
3
|
-
def self.new_from_file(
|
4
|
-
|
5
|
-
|
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
|
-
|
10
|
-
|
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(
|
15
|
-
|
16
|
-
|
17
|
-
|
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 #{
|
21
|
-
|
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", :
|
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.", :
|
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
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.
|
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-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|