lib/kafo/configuration.rb in kafo-2.0.2 vs lib/kafo/configuration.rb in kafo-2.1.0

- old
+ new

@@ -27,11 +27,12 @@ :colors => Kafo::ColorScheme.colors_possible?, :color_of_background => :dark, :hook_dirs => [], :custom => {}, :low_priority_modules => [], - :verbose_log_level => 'info' + :verbose_log_level => 'info', + :skip_puppet_version_check => false } def initialize(file, persist = true) @config_file = file @persist = persist @@ -164,14 +165,22 @@ command = PuppetCommand.new(dump_manifest, [], puppetconf, self).append('2>&1').command result = `#{command}` @logger.debug result unless $?.exitstatus == 0 log = app[:log_dir] + '/' + app[:log_name] - puts "Could not get default values, check log file at #{log} for more information" - @logger.error command - @logger.error result - @logger.error 'Could not get default values, cannot continue' - KafoConfigure.exit(:defaults_error) + if (version_mismatch = /kafo_configure::puppet_version_failure: (.+?\))/.match(result)) + puts version_mismatch[1] + puts "Cannot continue due to incompatible version of Puppet. Use --skip-puppet-version-check to disable this check." + @logger.error version_mismatch[1] + @logger.error 'Incompatible version of Puppet used, cannot continue' + KafoConfigure.exit(:puppet_version_error) + else + puts "Could not get default values, check log file at #{log} for more information" + @logger.error command + @logger.error result + @logger.error 'Could not get default values, cannot continue' + KafoConfigure.exit(:defaults_error) + end end @logger.info "... finished" load_yaml_from_output(result.split($/)) end