lib/splash/config.rb in prometheus-splash-0.0.3 vs lib/splash/config.rb in prometheus-splash-0.1.0

- old
+ new

@@ -16,11 +16,11 @@ self[:copyright] = "#{COPYRIGHT} #{LICENSE}" self[:prometheus_pushgateway_host] = (config_from_file[:prometheus][:pushgateway][:host])? config_from_file[:prometheus][:pushgateway][:host] : PROMETHEUS_PUSHGATEWAY_HOST self[:prometheus_pushgateway_port] = (config_from_file[:prometheus][:pushgateway][:port])? config_from_file[:prometheus][:pushgateway][:port] : PROMETHEUS_PUSHGATEWAY_PORT self[:daemon_process_name] = (config_from_file[:daemon][:process_name])? config_from_file[:daemon][:process_name] : DAEMON_PROCESS_NAME self[:daemon_logmon_scheduling] = (config_from_file[:daemon][:logmon_scheduling])? config_from_file[:daemon][:logmon_scheduling] : DAEMON_LOGMON_SCHEDULING - self[:execution_template_tokens] = (config_from_file[:templates][:execution][:tokens])? config_from_file[:templates][:execution][:tokens] : EXECUTION_TEMPLATE_TOKENS_LIST + self[:execution_template_tokens] = EXECUTION_TEMPLATE_TOKENS_LIST self[:execution_template_path] = (config_from_file[:templates][:execution][:path])? config_from_file[:templates][:execution][:path] : EXECUTION_TEMPLATE self[:pid_path] = (config_from_file[:daemon][:paths][:pid_path])? config_from_file[:daemon][:paths][:pid_path] : DAEMON_PID_PATH self[:trace_path] = (config_from_file[:daemon][:paths][:trace_path])? config_from_file[:daemon][:paths][:trace_path] : TRACE_PATH self[:pid_file] = (config_from_file[:daemon][:files][:pid_file])? config_from_file[:daemon][:files][:pid_file] : DAEMON_PID_FILE self[:stdout_trace] = (config_from_file[:daemon][:files][:stdout_trace])? config_from_file[:daemon][:files][:stdout_trace] : DAEMON_STDOUT_TRACE @@ -56,11 +56,11 @@ def backends return self[:backends] end def transports - return self[:transport] + return self[:transports] end def daemon_logmon_scheduling return self[:daemon_logmon_scheduling] end @@ -135,15 +135,19 @@ # @return [Integer] an errorcode value def setupsplash conf_in_path = search_file_in_gem "prometheus-splash", "config/splash.yml" full_res = 0 puts "Splash -> setup : " - print "* Installing Configuration file : #{CONFIG_FILE} : " - if install_file source: conf_in_path, target: CONFIG_FILE, mode: "644", owner: Configuration.user_root, group: Configuration.group_root then - puts "[OK]" + unless options[:preserve] then + print "* Installing Configuration file : #{CONFIG_FILE} : " + if install_file source: conf_in_path, target: CONFIG_FILE, mode: "644", owner: Configuration.user_root, group: Configuration.group_root then + puts "[OK]" + else + full_res =+ 1 + puts "[KO]" + end else - full_res =+ 1 - puts "[KO]" + puts "Config file preservation." end config = get_config report_in_path = search_file_in_gem "prometheus-splash", "templates/report.txt" print "* Installing template file : #{config.execution_template_path} : " if install_file source: report_in_path, target: config.execution_template_path, mode: "644", owner: config.user_root, group: config.group_root then