kafo 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -3
- data/config/kafo.yaml.example +1 -0
- data/lib/kafo/configuration.rb +21 -17
- data/lib/kafo/kafo_configure.rb +7 -4
- data/lib/kafo/params/array.rb +5 -1
- data/lib/kafo/params/hash.rb +5 -1
- data/lib/kafo/puppet_module.rb +8 -0
- data/lib/kafo/version.rb +1 -1
- data/lib/kafo/wizard.rb +2 -2
- data/modules/kafo_configure/lib/puppet/parser/functions/add_progress.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c90ef90e7f725d167df9f4cf981149fbf73ec80
|
4
|
+
data.tar.gz: 1fe6598e413848a5e3e20959e8d40b85d4a54265
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae156929be2c13cff6cb3224cc484a47b28dfdbe371415abfe60f1a9e80fa7e04f0a65d2ffa8bafe7bfd84805286adc4c462bcca05325a9f15da23dd95324c65
|
7
|
+
data.tar.gz: 694b8a569838d3f7ce01c9cbacb3233a386aa13a493ebcb6d4d4865837b321e1bcb9f3a6d0120b69e60ce8ccbb21347392633198dfaecae12276ee1de7c03458
|
data/README.md
CHANGED
@@ -171,6 +171,8 @@ false!
|
|
171
171
|
Sometimes you may want kafo not to store answers from current run. You can
|
172
172
|
disable saving by passing a ```--dont-save-answers``` argument (or -d for short).
|
173
173
|
|
174
|
+
Note that running ```--noop``` implies ```--dont-save-answers```.
|
175
|
+
|
174
176
|
## Parameters prefixes
|
175
177
|
|
176
178
|
You probably noticed that every module parameter is prefixed by module name
|
@@ -507,6 +509,10 @@ bin/foreman-installer --foreman-db-password=UNDEF
|
|
507
509
|
|
508
510
|
It also works in interactive mode.
|
509
511
|
|
512
|
+
You may also need to override array parameter with empty array value. For this
|
513
|
+
purpose you can use `EMPTY_ARRAY` string as a value. Similarly you can use
|
514
|
+
`EMPTY_HASH` for hash parameters.
|
515
|
+
|
510
516
|
## Hooks
|
511
517
|
|
512
518
|
You may need to add new features to the installer. Kafo provides simple hook
|
@@ -690,6 +696,25 @@ order:
|
|
690
696
|
If you have other modules in your answer file they will be executed after
|
691
697
|
those that have explicit order. Their order is not be specified.
|
692
698
|
|
699
|
+
## Changing the order of module appearance in interactive mode
|
700
|
+
|
701
|
+
We sort our module alphabetically. Sometimes you may want to reorder
|
702
|
+
module, e.g. display plugin modules last. For this you can use ```low_priority_modules```
|
703
|
+
configuration option. It accepts an array of patterns considering the
|
704
|
+
first to have the lowest priority. So in follwing example
|
705
|
+
|
706
|
+
```yaml
|
707
|
+
low_priority_modules:
|
708
|
+
- compute
|
709
|
+
- plugin
|
710
|
+
```
|
711
|
+
|
712
|
+
all modules containing a word compute in their name would be listed
|
713
|
+
at the end. If there are two modules containing compute, their order
|
714
|
+
is alphabetical on suffix after compute word. If there are some modules
|
715
|
+
containing word plugin, they will be above compute modules as they
|
716
|
+
were mentioned later.
|
717
|
+
|
693
718
|
## Changing of log directory and user/group
|
694
719
|
|
695
720
|
By default kafo logs every run to a separate file in /var/log/kafo.
|
@@ -710,8 +735,9 @@ but you want the logs to be readable by specific users.
|
|
710
735
|
|
711
736
|
When you want to make sure that user has some software installed or has the
|
712
737
|
right version you can write a simple script and put it into checks directory.
|
713
|
-
All files found there will be
|
714
|
-
|
738
|
+
All files found there will be executed and if any of these exits with an non-zero
|
739
|
+
exit code, kafo won't execute puppet but print an error message
|
740
|
+
`Your system does not meet configuration criteria.`
|
715
741
|
|
716
742
|
Everything on STDOUT and STDERR is logged in error level.
|
717
743
|
|
@@ -723,6 +749,11 @@ java -version 2>&1 | grep OpenJDK
|
|
723
749
|
exit $?
|
724
750
|
```
|
725
751
|
|
752
|
+
If you want to ignore results of check scripts, you can use the builtin
|
753
|
+
parameter `--skip-checks-i-know-better` (or `-s`). This will completely
|
754
|
+
disable running all system check scripts. Note that this option is
|
755
|
+
not persisted between runs.
|
756
|
+
|
726
757
|
## Exit code
|
727
758
|
|
728
759
|
Kafo can terminate either before or after puppet is ran. Puppet is ran with
|
@@ -741,7 +772,7 @@ Other exit codes that can be returned:
|
|
741
772
|
* '23' means that you have no answer file
|
742
773
|
* '24' means that your answer file asks for puppet module that you did not provide
|
743
774
|
* '25' means that kafo could not get default values from puppet
|
744
|
-
|
775
|
+
* '130' user interrupt (^C)
|
745
776
|
|
746
777
|
# License
|
747
778
|
|
data/config/kafo.yaml.example
CHANGED
data/lib/kafo/configuration.rb
CHANGED
@@ -13,19 +13,20 @@ module Kafo
|
|
13
13
|
end
|
14
14
|
|
15
15
|
DEFAULT = {
|
16
|
-
:log_dir
|
17
|
-
:log_name
|
18
|
-
:log_level
|
19
|
-
:no_prefix
|
20
|
-
:mapping
|
21
|
-
:answer_file
|
22
|
-
:installer_dir
|
23
|
-
:modules_dir
|
24
|
-
:default_values_dir
|
25
|
-
:colors
|
26
|
-
:color_of_background
|
27
|
-
:hook_dirs
|
28
|
-
:custom
|
16
|
+
:log_dir => '/var/log/kafo',
|
17
|
+
:log_name => 'configuration.log',
|
18
|
+
:log_level => 'info',
|
19
|
+
:no_prefix => false,
|
20
|
+
:mapping => {},
|
21
|
+
:answer_file => './config/answers.yaml',
|
22
|
+
:installer_dir => '.',
|
23
|
+
:modules_dir => './modules',
|
24
|
+
:default_values_dir => '/tmp',
|
25
|
+
:colors => Configuration.colors_possible?,
|
26
|
+
:color_of_background => :dark,
|
27
|
+
:hook_dirs => [],
|
28
|
+
:custom => {},
|
29
|
+
:low_priority_modules => [],
|
29
30
|
}
|
30
31
|
|
31
32
|
def initialize(file, persist = true)
|
@@ -81,7 +82,7 @@ module Kafo
|
|
81
82
|
end
|
82
83
|
|
83
84
|
def modules
|
84
|
-
@modules ||= @data.keys.map { |mod| PuppetModule.new(mod).parse }
|
85
|
+
@modules ||= @data.keys.map { |mod| PuppetModule.new(mod).parse }.sort
|
85
86
|
end
|
86
87
|
|
87
88
|
def add_module(name)
|
@@ -102,13 +103,16 @@ module Kafo
|
|
102
103
|
@logger.debug "Creating tmp dir within #{app[:default_values_dir]}..."
|
103
104
|
temp_dir = Dir.mktmpdir(nil, app[:default_values_dir])
|
104
105
|
KafoConfigure.exit_handler.register_cleanup_path temp_dir
|
105
|
-
@logger.info
|
106
|
+
@logger.info 'Loading default values from puppet modules...'
|
106
107
|
command = PuppetCommand.new("$temp_dir=\"#{temp_dir}\" #{includes} dump_values(#{params})").append('2>&1').command
|
107
|
-
|
108
|
+
result = `#{command}`
|
109
|
+
@logger.debug result
|
108
110
|
unless $?.exitstatus == 0
|
109
111
|
log = app[:log_dir] + '/' + app[:log_name]
|
110
112
|
puts "Could not get default values, check log file at #{log} for more information"
|
111
|
-
@logger.error
|
113
|
+
@logger.error command
|
114
|
+
@logger.error result
|
115
|
+
@logger.error 'Could not get default values, cannot continue'
|
112
116
|
KafoConfigure.exit(:defaults_error)
|
113
117
|
end
|
114
118
|
@logger.info "... finished"
|
data/lib/kafo/kafo_configure.rb
CHANGED
@@ -84,9 +84,11 @@ module Kafo
|
|
84
84
|
@progress_bar = self.class.config.app[:colors] ? ProgressBars::Colored.new : ProgressBars::BlackWhite.new
|
85
85
|
end
|
86
86
|
|
87
|
-
unless
|
88
|
-
|
89
|
-
|
87
|
+
unless skip_checks_i_know_better?
|
88
|
+
unless SystemChecker.check
|
89
|
+
puts "Your system does not meet configuration criteria"
|
90
|
+
self.class.exit(:invalid_system)
|
91
|
+
end
|
90
92
|
end
|
91
93
|
|
92
94
|
self.class.hooking.execute(:pre_validations)
|
@@ -100,7 +102,7 @@ module Kafo
|
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
103
|
-
if dont_save_answers?
|
105
|
+
if dont_save_answers? || noop?
|
104
106
|
self.class.temp_config_file = temp_config_file
|
105
107
|
store_params(temp_config_file)
|
106
108
|
else
|
@@ -207,6 +209,7 @@ module Kafo
|
|
207
209
|
:default => config.app[:log_level]
|
208
210
|
self.class.app_option ['-n', '--noop'], :flag, 'Run puppet in noop mode?',
|
209
211
|
:default => false
|
212
|
+
self.class.app_option ['-s', '--skip-checks-i-know-better'], :flag, 'Skip all system checks', :default => false
|
210
213
|
self.class.app_option ['-v', '--verbose'], :flag, 'Display log on STDOUT instead of progressbar'
|
211
214
|
self.class.app_option ['-l', '--verbose-log-level'], 'LEVEL', 'Log level for verbose mode output',
|
212
215
|
:default => 'info'
|
data/lib/kafo/params/array.rb
CHANGED
data/lib/kafo/params/hash.rb
CHANGED
data/lib/kafo/puppet_module.rb
CHANGED
@@ -78,6 +78,14 @@ module Kafo
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def <=> o
|
81
|
+
KafoConfigure.config.app[:low_priority_modules].each do |module_name|
|
82
|
+
return 1 if self.name.include?(module_name) && !o.name.include?(module_name)
|
83
|
+
return -1 if !self.name.include?(module_name) && o.name.include?(module_name)
|
84
|
+
if self.name.include?(module_name) && o.name.include?(module_name)
|
85
|
+
return self.name.sub(/.*#{module_name}/, '') <=> o.name.sub(/.*#{module_name}/, '')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
81
89
|
self.name <=> o.name
|
82
90
|
end
|
83
91
|
|
data/lib/kafo/version.rb
CHANGED
data/lib/kafo/wizard.rb
CHANGED
@@ -34,7 +34,7 @@ END
|
|
34
34
|
main_menu
|
35
35
|
rescue Interrupt
|
36
36
|
puts "Got interrupt, exiting"
|
37
|
-
KafoConfigure.exit(
|
37
|
+
KafoConfigure.exit(130)
|
38
38
|
end
|
39
39
|
|
40
40
|
private
|
@@ -84,7 +84,7 @@ END
|
|
84
84
|
if mod.enabled?
|
85
85
|
render_params(mod.primary_parameter_group.params, menu)
|
86
86
|
|
87
|
-
others = mod.primary_parameter_group.children + mod.other_parameter_groups
|
87
|
+
others = (mod.primary_parameter_group.children + mod.other_parameter_groups).uniq
|
88
88
|
others.each do |group|
|
89
89
|
menu.choice("Configure #{group.formatted_name}") { configure_group(group) }
|
90
90
|
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.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Hulan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -143,6 +143,9 @@ dependencies:
|
|
143
143
|
- - '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: 1.6.21
|
146
|
+
- - <
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '1.7'
|
146
149
|
type: :runtime
|
147
150
|
prerelease: false
|
148
151
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -150,6 +153,9 @@ dependencies:
|
|
150
153
|
- - '>='
|
151
154
|
- !ruby/object:Gem::Version
|
152
155
|
version: 1.6.21
|
156
|
+
- - <
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '1.7'
|
153
159
|
- !ruby/object:Gem::Dependency
|
154
160
|
name: powerbar
|
155
161
|
requirement: !ruby/object:Gem::Requirement
|