kafo 0.9.4 → 0.9.5
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 +15 -9
- data/lib/kafo/configuration.rb +8 -3
- data/lib/kafo/hook_context.rb +7 -0
- data/lib/kafo/parser_cache_reader.rb +1 -1
- data/lib/kafo/version.rb +1 -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: a0891988265b632e07a6cc18c78d1675cdce70ff
|
4
|
+
data.tar.gz: 6225f461595283a292a6c9ed9ccad6ae1cc3ca04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58caffa69d462436a789a1a23a5cc238872e39393ebe5216f94f69e3ff44ddea5c94debf3642ef646799bc69e19d1c62ebc197a310cdad688c08e096881e757b
|
7
|
+
data.tar.gz: 7d89c58aac9b309531cbb7ebe3666a08fca3c41d9b59ef7de899c333befbc8af333496b0db50875fd1b50fd89f3f5191f229a685be7d44c35fc1cf80eeb81357
|
data/README.md
CHANGED
@@ -762,15 +762,21 @@ KafoConfigure.hooking.register_pre(:reset_db) do
|
|
762
762
|
end
|
763
763
|
```
|
764
764
|
|
765
|
-
Note that the hook is evaluated in HookContext object which provides
|
766
|
-
|
767
|
-
```
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
765
|
+
Note that the hook is evaluated in HookContext object which provides a DSL:
|
766
|
+
|
767
|
+
* ```app_option``` creates a new installer option
|
768
|
+
* ```app_value(:reset_foreman_db)``` accesses values of installer options
|
769
|
+
* ```param('module name', 'parameter name')``` accessor allows parameters to be modified if already
|
770
|
+
defined
|
771
|
+
* ```add_module``` registers your own module not specified in the answer file (custom mapping is also
|
772
|
+
supported), useful if you need to add some module to the existing installer based on kafo but you
|
773
|
+
don't have control over its source code
|
774
|
+
* ```module_enabled?('module_name')``` indicates whether a module is currently enabled
|
775
|
+
* ```get_custom_config``` and ```store_custom_config``` access custom config storage which persists
|
776
|
+
among kafo runs
|
777
|
+
* ```logger``` is also available for writing log messages
|
778
|
+
|
779
|
+
For more details, see
|
774
780
|
[hook_context.rb](https://github.com/theforeman/kafo/blob/master/lib/kafo/hook_context.rb).
|
775
781
|
|
776
782
|
If you don't want to modify your installer script you can place your hooks into the
|
data/lib/kafo/configuration.rb
CHANGED
@@ -88,6 +88,10 @@ module Kafo
|
|
88
88
|
@modules ||= @data.keys.map { |mod| PuppetModule.new(mod, PuppetModule.find_parser, self).parse }.sort
|
89
89
|
end
|
90
90
|
|
91
|
+
def module(name)
|
92
|
+
modules.find { |m| m.name == name }
|
93
|
+
end
|
94
|
+
|
91
95
|
def root_dir
|
92
96
|
File.expand_path(app[:installer_dir])
|
93
97
|
end
|
@@ -184,8 +188,9 @@ module Kafo
|
|
184
188
|
@params ||= modules.map(&:params).flatten
|
185
189
|
end
|
186
190
|
|
187
|
-
def param(
|
188
|
-
|
191
|
+
def param(mod_name, param_name)
|
192
|
+
mod = self.module(mod_name)
|
193
|
+
mod.nil? ? nil : mod.params.find { |p| p.name == param_name }
|
189
194
|
end
|
190
195
|
|
191
196
|
def preset_defaults_from_puppet
|
@@ -264,7 +269,7 @@ module Kafo
|
|
264
269
|
|
265
270
|
def parser_cache
|
266
271
|
if app[:parser_cache_path]
|
267
|
-
@parser_cache ||= Kafo::ParserCacheReader.new_from_file(
|
272
|
+
@parser_cache ||= Kafo::ParserCacheReader.new_from_file(app[:parser_cache_path])
|
268
273
|
end
|
269
274
|
end
|
270
275
|
|
data/lib/kafo/hook_context.rb
CHANGED
@@ -61,6 +61,13 @@ module Kafo
|
|
61
61
|
self.kafo.add_module(module_name)
|
62
62
|
end
|
63
63
|
|
64
|
+
# Check if a module is enabled in the current configuration.
|
65
|
+
# examples:
|
66
|
+
# module_enabled?('example')
|
67
|
+
def module_enabled?(module_name)
|
68
|
+
self.kafo.module(module_name).enabled?
|
69
|
+
end
|
70
|
+
|
64
71
|
# You can trigger installer exit by this method. You must specify exit code as a first
|
65
72
|
# argument. You can also specify a symbol alias which is built-in (see exit_handler.rb
|
66
73
|
# for more details).
|
@@ -15,7 +15,7 @@ module Kafo
|
|
15
15
|
return nil
|
16
16
|
end
|
17
17
|
|
18
|
-
parsed = cache_paths.map { |path| YAML.load(File.read(path)) }
|
18
|
+
parsed = cache_paths.map { |path| YAML.load(File.read(File.expand_path(path))) }
|
19
19
|
|
20
20
|
parsed.each_with_index do |cache, i|
|
21
21
|
if !cache.is_a?(Hash) || cache[:version] != PARSER_CACHE_VERSION || !cache[:files].is_a?(Hash)
|
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.5
|
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-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|