kafo 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -2
- data/bin/kafo-export-params +42 -22
- data/config/kafo.yaml.example +2 -0
- data/lib/kafo/configuration.rb +9 -1
- data/lib/kafo/kafo_configure.rb +9 -1
- data/lib/kafo/param_builder.rb +1 -1
- data/lib/kafo/parser_cache_reader.rb +47 -0
- data/lib/kafo/parser_cache_writer.rb +14 -0
- data/lib/kafo/puppet_module.rb +7 -4
- data/lib/kafo/scenario_manager.rb +46 -33
- data/lib/kafo/system_checker.rb +1 -1
- data/lib/kafo/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 357f8e1980ad47e91e5c7d8320a8abab921bb1c8
|
4
|
+
data.tar.gz: cbd0e38cb265b461b1b37a7c4055b675263f41eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 929c44d536d597978e5cbc19989e496bed18386b254938d25c121046132a939f217b1c8393af8ede19f63d19756f3d2d0ea0f65c4c5e8091cdfad150fdd15c6f
|
7
|
+
data.tar.gz: 57167458f21fa390c7600879dcb9835264dfc931ac51b891213b8c9e99157864b2144b9666d64e40258770b11d097a45d67e4020d242658a8e82d685e0256e85
|
data/README.md
CHANGED
@@ -302,7 +302,7 @@ The installer stores names of applied migrations in `<config>/installer-scenario
|
|
302
302
|
It is recommended to prefix the migration names with `date +%y%m%d%H%M%S` to avoid migration ordering issues.
|
303
303
|
|
304
304
|
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.
|
305
|
-
If you just want to apply the migrations you can use `--migrations-only` switch.
|
305
|
+
If you just want to apply the migrations you can use `--migrations-only` switch.
|
306
306
|
Note that `--noop` and `--dont-save-answers` has no effect on migrations.
|
307
307
|
|
308
308
|
Sample migration adding new module could look like as follows:
|
@@ -317,6 +317,20 @@ Sample migration adding new module could look like as follows:
|
|
317
317
|
EOF
|
318
318
|
```
|
319
319
|
|
320
|
+
### Enabling/disabling scenarios
|
321
|
+
|
322
|
+
Scenarios that are deprecated or wanted to be hidden on the system can be disabled with:
|
323
|
+
|
324
|
+
```bash
|
325
|
+
foreman-installer --disable-scenario deprecated-scenario
|
326
|
+
Scenario deprecated-scenario was disabled.
|
327
|
+
```
|
328
|
+
The disabled scenario is not shown in the scenario list and is prevented from being installed.
|
329
|
+
It is not deleted from the file system however so the custom values in the answer file are preserved
|
330
|
+
and e.g. migration to new scenario is still possible.
|
331
|
+
|
332
|
+
Disabled scenario can be enabled back again with `foreman-installer --enable-scenario SCENARIO`.
|
333
|
+
|
320
334
|
## Documentation
|
321
335
|
|
322
336
|
Every parameter that can be set by kafo *must* be documented. This means that
|
@@ -894,6 +908,22 @@ parameter `--skip-checks-i-know-better` (or `-s`). This will completely
|
|
894
908
|
disable running all system check scripts. Note that this option is
|
895
909
|
not persisted between runs.
|
896
910
|
|
911
|
+
## Parser cache
|
912
|
+
|
913
|
+
A cache of parsed Puppet modules and manifests can be created to skip the use
|
914
|
+
of kafo_parsers at runtime. This is useful when kafo_parsers doesn't support the
|
915
|
+
version of Puppet in use, and may also provide a small performance benefit.
|
916
|
+
|
917
|
+
Create the cache with `kafo-export-params -f parsercache --no-parser-cache` and
|
918
|
+
configure it in config/kafo.yaml with:
|
919
|
+
|
920
|
+
```yaml
|
921
|
+
:parser_cache_path: ./parser_cache.yaml
|
922
|
+
```
|
923
|
+
|
924
|
+
The cache will be skipped if the file modification time of the manifest is
|
925
|
+
greater than the mtime recorded in the cache.
|
926
|
+
|
897
927
|
## Exit code
|
898
928
|
|
899
929
|
Kafo can terminate either before or after puppet is run. If it is run with
|
@@ -913,7 +943,7 @@ Other exit codes that can be returned:
|
|
913
943
|
* '24' means that your answer file asks for puppet module that you did not provide
|
914
944
|
* '25' means that kafo could not get default values from puppet
|
915
945
|
* '26' means that kafo could not find the specified scenario
|
916
|
-
* '27' means that kafo found
|
946
|
+
* '27' means that kafo found found scenario configuration error that prevents installation from continuing
|
917
947
|
* '130' user interrupt (^C)
|
918
948
|
|
919
949
|
## Running Puppet Profiling
|
data/bin/kafo-export-params
CHANGED
@@ -3,12 +3,12 @@ require 'rubygems'
|
|
3
3
|
require 'ostruct'
|
4
4
|
require 'clamp'
|
5
5
|
require 'logging'
|
6
|
-
require 'kafo/
|
6
|
+
require 'kafo/configuration'
|
7
7
|
require 'kafo/exceptions'
|
8
|
+
require 'kafo/parser_cache_writer'
|
9
|
+
require 'kafo/string_helper'
|
8
10
|
require 'logger'
|
9
|
-
|
10
|
-
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'kafo'))
|
11
|
-
require 'configuration'
|
11
|
+
require 'yaml'
|
12
12
|
|
13
13
|
KafoConfigure = OpenStruct.new
|
14
14
|
def KafoConfigure.exit(code)
|
@@ -17,35 +17,53 @@ end
|
|
17
17
|
|
18
18
|
module Kafo
|
19
19
|
class KafoExportParams < Clamp::Command
|
20
|
-
TYPES = %w(md html asciidoc)
|
20
|
+
TYPES = %w(md html asciidoc parsercache)
|
21
21
|
|
22
22
|
option ['-c', '--config'], 'FILE', 'Config file for which should we generate params',
|
23
23
|
:required => true
|
24
24
|
|
25
25
|
option ['-f', '--format'], 'FORMAT',
|
26
|
-
|
26
|
+
"Format parameters will be written in, valid options: #{TYPES.join(',')}", :default => 'md' do |format|
|
27
27
|
format = format.downcase
|
28
28
|
raise ArgumentError unless TYPES.include?(format)
|
29
29
|
format
|
30
30
|
end
|
31
31
|
|
32
|
+
option ['-o', '--output'], 'FILE', 'Output file to write parameters into', :default => '-'
|
33
|
+
|
34
|
+
option '--[no-]parser-cache', :flag, 'Enable or disable the parser cache, disable for fresh results', :default => true
|
35
|
+
|
32
36
|
def execute
|
33
37
|
c = Configuration.new(config, false)
|
38
|
+
c.app[:parser_cache_path] = nil unless parser_cache?
|
34
39
|
KafoConfigure.config = c
|
35
40
|
KafoConfigure.root_dir = File.expand_path(c.app[:installer_dir])
|
36
|
-
KafoConfigure.module_dirs =
|
37
|
-
KafoConfigure.logger = Logger.new(
|
41
|
+
KafoConfigure.module_dirs = c.module_dirs
|
42
|
+
KafoConfigure.logger = Logger.new(STDERR)
|
38
43
|
|
39
|
-
|
44
|
+
if output == '-'
|
45
|
+
file = STDOUT
|
46
|
+
else
|
47
|
+
file = File.open(output, 'w')
|
48
|
+
end
|
49
|
+
|
50
|
+
exporter = self.class.const_get(format.capitalize).new(c, file)
|
40
51
|
exporter.print_out
|
41
52
|
end
|
42
53
|
|
43
|
-
class
|
44
|
-
|
45
|
-
|
46
|
-
def initialize(config)
|
54
|
+
class Writer
|
55
|
+
def initialize(config, file)
|
47
56
|
@config = config
|
57
|
+
@file = file
|
58
|
+
end
|
59
|
+
|
60
|
+
def puts(*args)
|
61
|
+
@file.puts(*args)
|
48
62
|
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class Html < Writer
|
66
|
+
include StringHelper
|
49
67
|
|
50
68
|
def print_out
|
51
69
|
puts '<div id="installer-options">'
|
@@ -79,13 +97,9 @@ module Kafo
|
|
79
97
|
end
|
80
98
|
end
|
81
99
|
|
82
|
-
class Asciidoc
|
100
|
+
class Asciidoc < Writer
|
83
101
|
include StringHelper
|
84
102
|
|
85
|
-
def initialize(config)
|
86
|
-
@config = config
|
87
|
-
end
|
88
|
-
|
89
103
|
def print_out
|
90
104
|
@config.modules.sort.each do |mod|
|
91
105
|
puts "Parameters for '#{mod.name}':\n\n"
|
@@ -99,12 +113,12 @@ module Kafo
|
|
99
113
|
end
|
100
114
|
end
|
101
115
|
|
102
|
-
class Md
|
116
|
+
class Md < Writer
|
103
117
|
include StringHelper
|
104
118
|
|
105
|
-
def initialize(
|
106
|
-
|
107
|
-
@max
|
119
|
+
def initialize(*args)
|
120
|
+
super
|
121
|
+
@max = max_description_length
|
108
122
|
end
|
109
123
|
|
110
124
|
def print_out
|
@@ -129,6 +143,12 @@ module Kafo
|
|
129
143
|
doc_lengths.max
|
130
144
|
end
|
131
145
|
end
|
146
|
+
|
147
|
+
class Parsercache < Writer
|
148
|
+
def print_out
|
149
|
+
puts Kafo::ParserCacheWriter.write(@config.modules).to_yaml
|
150
|
+
end
|
151
|
+
end
|
132
152
|
end
|
133
153
|
end
|
134
154
|
|
data/config/kafo.yaml.example
CHANGED
@@ -16,6 +16,8 @@
|
|
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
21
|
# Enable colors? If you don't touch this, we'll autodetect terminal capabilities
|
20
22
|
# :colors: true
|
21
23
|
# Color scheme, we support :bright and :dark (first is better for white background, dark for black background)
|
data/lib/kafo/configuration.rb
CHANGED
@@ -12,6 +12,7 @@ module Kafo
|
|
12
12
|
DEFAULT = {
|
13
13
|
:name => '',
|
14
14
|
:description => '',
|
15
|
+
:enabled => true,
|
15
16
|
:log_dir => '/var/log/kafo',
|
16
17
|
:log_name => 'configuration.log',
|
17
18
|
:log_level => 'info',
|
@@ -26,7 +27,8 @@ module Kafo
|
|
26
27
|
:hook_dirs => [],
|
27
28
|
:custom => {},
|
28
29
|
:low_priority_modules => [],
|
29
|
-
:verbose_log_level => 'info'
|
30
|
+
:verbose_log_level => 'info',
|
31
|
+
:parser_cache_path => './config/parser_cache.json'
|
30
32
|
}
|
31
33
|
|
32
34
|
def initialize(file, persist = true)
|
@@ -256,6 +258,12 @@ module Kafo
|
|
256
258
|
@config_file.gsub(/\.yaml$/, '.migrations')
|
257
259
|
end
|
258
260
|
|
261
|
+
def parser_cache
|
262
|
+
if app[:parser_cache_path]
|
263
|
+
@parser_cache ||= Kafo::ParserCacheReader.new_from_file(File.expand_path(app[:parser_cache_path]))
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
259
267
|
private
|
260
268
|
|
261
269
|
def custom_storage
|
data/lib/kafo/kafo_configure.rb
CHANGED
@@ -52,6 +52,8 @@ module Kafo
|
|
52
52
|
|
53
53
|
# Handle --list-scenarios before we need them
|
54
54
|
scenario_manager.list_available_scenarios if ARGV.include?('--list-scenarios')
|
55
|
+
scenario_manager.check_enable_scenario
|
56
|
+
scenario_manager.check_disable_scenario
|
55
57
|
setup_config(config_file)
|
56
58
|
|
57
59
|
self.class.hooking.execute(:pre_migrations)
|
@@ -76,7 +78,7 @@ module Kafo
|
|
76
78
|
|
77
79
|
if scenario_manager.configured?
|
78
80
|
scenario_manager.check_scenario_change(self.class.config_file)
|
79
|
-
if scenario_manager.scenario_changed?(self.class.config_file)
|
81
|
+
if scenario_manager.scenario_changed?(self.class.config_file) && !self.class.in_help_mode?
|
80
82
|
prev_config = scenario_manager.load_configuration(scenario_manager.previous_scenario)
|
81
83
|
prev_config.run_migrations
|
82
84
|
self.class.config.migrate_configuration(prev_config, :skip => [:log_name])
|
@@ -164,6 +166,10 @@ module Kafo
|
|
164
166
|
self.exit_handler.exit_code
|
165
167
|
end
|
166
168
|
|
169
|
+
def self.in_help_mode?
|
170
|
+
ARGV.include?('--help') || ARGV.include?('--full-help') || ARGV.include?('-h')
|
171
|
+
end
|
172
|
+
|
167
173
|
def exit_code
|
168
174
|
self.class.exit_code
|
169
175
|
end
|
@@ -270,6 +276,8 @@ module Kafo
|
|
270
276
|
self.class.app_option ['-l', '--verbose-log-level'], 'LEVEL', 'Log level for verbose mode output',
|
271
277
|
:default => 'info'
|
272
278
|
self.class.app_option ['-S', '--scenario'], 'SCENARIO', 'Use installation scenario'
|
279
|
+
self.class.app_option ['--disable-scenario'], 'SCENARIO', 'Disable installation scenario'
|
280
|
+
self.class.app_option ['--enable-scenario'], 'SCENARIO', 'Enable installation scenario'
|
273
281
|
self.class.app_option ['--list-scenarios'], :flag, 'List available installation scenaraios'
|
274
282
|
self.class.app_option ['--force'], :flag, 'Force change of installation scenaraio'
|
275
283
|
self.class.app_option ['--compare-scenarios'], :flag, 'Show changes between last used scenario and the scenario specified with -S or --scenario argument'
|
data/lib/kafo/param_builder.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
module Kafo
|
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"
|
6
|
+
return nil
|
7
|
+
end
|
8
|
+
|
9
|
+
unless File.exist?(cache_path)
|
10
|
+
logger.warn "Parser cache configured at #{cache_path} is missing, skipping setup"
|
11
|
+
return nil
|
12
|
+
end
|
13
|
+
|
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
|
18
|
+
end
|
19
|
+
|
20
|
+
logger.debug "Using #{cache_path} cache with parsed modules"
|
21
|
+
new(parsed)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.logger
|
25
|
+
KafoConfigure.logger
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(cache)
|
29
|
+
@cache = cache
|
30
|
+
end
|
31
|
+
|
32
|
+
def logger
|
33
|
+
KafoConfigure.logger
|
34
|
+
end
|
35
|
+
|
36
|
+
def get(key, manifest_path)
|
37
|
+
return nil unless @cache[:files].has_key?(key)
|
38
|
+
|
39
|
+
if @cache[:files][key][:mtime] && File.mtime(manifest_path).to_i > @cache[:files][key][:mtime]
|
40
|
+
logger.debug "Parser cache for #{manifest_path} is outdated, ignoring cache entry"
|
41
|
+
return nil
|
42
|
+
end
|
43
|
+
|
44
|
+
@cache[:files][key][:data]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Kafo
|
2
|
+
class ParserCacheWriter
|
3
|
+
def self.write(modules)
|
4
|
+
{
|
5
|
+
:version => 1,
|
6
|
+
:files => Hash[modules.sort.map { |m| write_module(m) }]
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.write_module(mod)
|
11
|
+
[mod.identifier, {:data => mod.raw_data, :mtime => File.mtime(mod.manifest_path).to_i}]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/kafo/puppet_module.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'kafo/param'
|
3
3
|
require 'kafo/param_builder'
|
4
|
+
require 'kafo/parser_cache_reader'
|
4
5
|
require 'kafo_parsers/puppet_module_parser'
|
5
6
|
require 'kafo/validator'
|
6
7
|
|
@@ -9,7 +10,7 @@ module Kafo
|
|
9
10
|
PRIMARY_GROUP_NAME = 'Parameters'
|
10
11
|
|
11
12
|
attr_reader :name, :identifier, :params, :dir_name, :class_name, :manifest_name, :manifest_path,
|
12
|
-
:groups, :params_path, :params_class_name, :configuration
|
13
|
+
:groups, :params_path, :params_class_name, :configuration, :raw_data
|
13
14
|
|
14
15
|
def initialize(identifier, parser = KafoParsers::PuppetModuleParser, configuration = KafoConfigure.config)
|
15
16
|
@identifier = identifier
|
@@ -27,6 +28,7 @@ module Kafo
|
|
27
28
|
end
|
28
29
|
@manifest_path = File.join(module_dir, module_manifest_path)
|
29
30
|
@parser = parser
|
31
|
+
@parser_cache = @configuration.parser_cache
|
30
32
|
@validations = []
|
31
33
|
@logger = KafoConfigure.logger
|
32
34
|
@groups = {}
|
@@ -48,9 +50,10 @@ module Kafo
|
|
48
50
|
|
49
51
|
def parse(builder_klass = ParamBuilder)
|
50
52
|
@params = []
|
51
|
-
raw_data
|
52
|
-
|
53
|
-
|
53
|
+
@raw_data = @parser_cache.get(identifier, manifest_path) if @parser_cache
|
54
|
+
@raw_data ||= @parser.parse(manifest_path)
|
55
|
+
builder = builder_klass.new(self, @raw_data)
|
56
|
+
@validations = @raw_data[:validations]
|
54
57
|
|
55
58
|
builder.validate
|
56
59
|
@params = builder.build_params
|
@@ -17,7 +17,7 @@ module Kafo
|
|
17
17
|
@available_scenarios ||= Dir.glob(File.join(config_dir, '*.yaml')).reject { |f| f =~ /#{last_scenario_link}$/ }.inject({}) do |scns, scn_file|
|
18
18
|
begin
|
19
19
|
content = YAML.load_file(scn_file)
|
20
|
-
if content.is_a?(Hash) && content.has_key?(:answer_file)
|
20
|
+
if content.is_a?(Hash) && content.has_key?(:answer_file) && content.fetch(:enabled, true)
|
21
21
|
# add scenario name for legacy configs
|
22
22
|
content[:name] = File.basename(scn_file, '.yaml') unless content.has_key?(:name)
|
23
23
|
scns[scn_file] = content
|
@@ -76,14 +76,13 @@ module Kafo
|
|
76
76
|
!!(defined?(CONFIG_DIR) && CONFIG_DIR)
|
77
77
|
end
|
78
78
|
|
79
|
-
def scenario_from_args
|
79
|
+
def scenario_from_args(arg_name='--scenario|-S')
|
80
80
|
# try scenario provided in the args via -S or --scenario
|
81
|
-
parsed = ARGV.join(" ").match /(
|
81
|
+
parsed = ARGV.join(" ").match /(#{arg_name})(\s+|[=]?)(\S+)/
|
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
|
-
|
86
|
-
KafoConfigure.exit(:unknown_scenario)
|
85
|
+
fail_now("Scenario (#{scenario_file}) was not found, can not continue", :unknown_scenario)
|
87
86
|
end
|
88
87
|
end
|
89
88
|
|
@@ -93,20 +92,13 @@ module Kafo
|
|
93
92
|
select_scenario_interactively
|
94
93
|
if scenario.nil?
|
95
94
|
fail_now("Scenario was not selected, can not continue. Use --list-scenarios to list available options.", :unknown_scenario)
|
95
|
+
elsif !scenario_enabled?(scenario)
|
96
|
+
fail_now("Selected scenario is DISABLED, can not continue. Use --list-scenarios to list available options." \
|
97
|
+
" You can also --enable-scenario SCENARIO to make the selected scenario available.", :scenario_error)
|
96
98
|
end
|
97
99
|
scenario
|
98
100
|
end
|
99
101
|
|
100
|
-
def scenario_from_args
|
101
|
-
# try scenario provided in the args via -S or --scenario
|
102
|
-
parsed = ARGV.join(" ").match /(--scenario|-S)(\s+|[=]?)(\S+)/
|
103
|
-
if parsed
|
104
|
-
scenario_file = File.join(config_dir, "#{parsed[3]}.yaml")
|
105
|
-
return scenario_file if File.exists?(scenario_file)
|
106
|
-
fail_now("Scenario (#{scenario_file}) was not found, can not continue", :unknown_scenario)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
102
|
def show_scenario_diff(prev_scenario, new_scenario)
|
111
103
|
say ::HighLine.color("Scenarios are being compared, that may take a while...", :info)
|
112
104
|
prev_conf = load_and_setup_configuration(prev_scenario)
|
@@ -126,27 +118,48 @@ module Kafo
|
|
126
118
|
end
|
127
119
|
end
|
128
120
|
|
121
|
+
def check_enable_scenario
|
122
|
+
scenario = scenario_from_args('--enable-scenario')
|
123
|
+
set_scenario_availability(scenario, true) if scenario
|
124
|
+
end
|
125
|
+
|
126
|
+
def check_disable_scenario
|
127
|
+
scenario = scenario_from_args('--disable-scenario')
|
128
|
+
set_scenario_availability(scenario, false) if scenario
|
129
|
+
end
|
130
|
+
|
131
|
+
def set_scenario_availability(scenario, available)
|
132
|
+
cfg = load_configuration(scenario)
|
133
|
+
cfg.app[:enabled] = available
|
134
|
+
cfg.save_configuration(cfg.app)
|
135
|
+
say "Scenario #{File.basename(scenario, ".yaml")} was #{available ? "enabled" : "disabled"}"
|
136
|
+
KafoConfigure.exit(0)
|
137
|
+
end
|
138
|
+
|
139
|
+
def scenario_enabled?(scenario)
|
140
|
+
load_configuration(scenario).app[:enabled]
|
141
|
+
end
|
142
|
+
|
129
143
|
def confirm_scenario_change(new_scenario)
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
dump_log_and_exit(0)
|
142
|
-
end
|
143
|
-
else
|
144
|
-
message = "You are trying to replace existing installation with different scenario. This may lead to unpredictable states. " +
|
145
|
-
"Use --force to override. You can use --compare-scenarios to see the differences"
|
146
|
-
KafoConfigure.logger.error(message)
|
147
|
-
dump_log_and_exit(:scenario_error)
|
144
|
+
if (ARGV & ['--interactive', '-i']).any?
|
145
|
+
show_scenario_diff(@previous_scenario, new_scenario)
|
146
|
+
|
147
|
+
wizard = KafoWizards.wizard(:cli, 'Confirm installation scenario selection',
|
148
|
+
:description => "You are trying to replace existing installation with different scenario. This may lead to unpredictable states. Please confirm that you want to proceed.")
|
149
|
+
wizard.entries << wizard.factory.button(:proceed, :label => 'Proceed with selected installation scenario', :default => false)
|
150
|
+
wizard.entries << wizard.factory.button(:cancel, :label => 'Cancel Installation', :default => true)
|
151
|
+
result = wizard.run
|
152
|
+
if result == :cancel
|
153
|
+
say 'Installation was cancelled by user'
|
154
|
+
dump_log_and_exit(0)
|
148
155
|
end
|
156
|
+
elsif !ARGV.include?('--force') && !KafoConfigure.in_help_mode?
|
157
|
+
message = "You are trying to replace existing installation with different scenario. This may lead to unpredictable states. " +
|
158
|
+
"Use --force to override. You can use --compare-scenarios to see the differences"
|
159
|
+
KafoConfigure.logger.error(message)
|
160
|
+
dump_log_and_exit(:scenario_error)
|
149
161
|
end
|
162
|
+
true
|
150
163
|
end
|
151
164
|
|
152
165
|
def print_scenario_diff(prev_conf, new_conf)
|
data/lib/kafo/system_checker.rb
CHANGED
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.7.
|
4
|
+
version: 0.7.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-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 11.0.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "<"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 11.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,6 +241,8 @@ files:
|
|
241
241
|
- lib/kafo/params/integer.rb
|
242
242
|
- lib/kafo/params/password.rb
|
243
243
|
- lib/kafo/params/string.rb
|
244
|
+
- lib/kafo/parser_cache_reader.rb
|
245
|
+
- lib/kafo/parser_cache_writer.rb
|
244
246
|
- lib/kafo/password_manager.rb
|
245
247
|
- lib/kafo/progress_bar.rb
|
246
248
|
- lib/kafo/progress_bars/black_white.rb
|