Class: CLISplash::Config

Inherits:
Thor
  • Object
show all
Includes:
Splash::Backends, Splash::ConfigUtilities, Splash::Exiter, Splash::Helpers, Splash::Loggers
Defined in:
lib/splash/cli/config.rb

Overview

Thor inherited class for configuration management

Constant Summary

Constants included from Splash::Constants

Splash::Constants::AUTHOR, Splash::Constants::BACKENDS_STRUCT, Splash::Constants::CONFIG_FILE, Splash::Constants::COPYRIGHT, Splash::Constants::DAEMON_LOGMON_SCHEDULING, Splash::Constants::DAEMON_METRICS_SCHEDULING, Splash::Constants::DAEMON_PID_FILE, Splash::Constants::DAEMON_PROCESS_NAME, Splash::Constants::DAEMON_PROCMON_SCHEDULING, Splash::Constants::DAEMON_STDERR_TRACE, Splash::Constants::DAEMON_STDOUT_TRACE, Splash::Constants::DEFAULT_RETENTION, Splash::Constants::EMAIL, Splash::Constants::EXECUTION_TEMPLATE, Splash::Constants::EXECUTION_TEMPLATE_TOKENS_LIST, Splash::Constants::LICENSE, Splash::Constants::LOGGERS_STRUCT, Splash::Constants::PID_PATH, Splash::Constants::PROMETHEUS_ALERTMANAGER_URL, Splash::Constants::PROMETHEUS_PUSHGATEWAY_URL, Splash::Constants::PROMETHEUS_URL, Splash::Constants::TRACE_PATH, Splash::Constants::TRANSPORTS_STRUCT, Splash::Constants::VERSION, Splash::Constants::WEBADMIN_IP, Splash::Constants::WEBADMIN_PID_FILE, Splash::Constants::WEBADMIN_PID_PATH, Splash::Constants::WEBADMIN_PORT, Splash::Constants::WEBADMIN_PROCESS_NAME, Splash::Constants::WEBADMIN_PROXY, Splash::Constants::WEBADMIN_STDERR_TRACE, Splash::Constants::WEBADMIN_STDOUT_TRACE

Constants included from Splash::Loggers

Splash::Loggers::ALIAS, Splash::Loggers::LEVELS

Constants included from Splash::Exiter

Splash::Exiter::EXIT_MAP

Instance Method Summary collapse

Methods included from Splash::Backends

#get_backend, #list_backends

Methods included from Splash::Config

#get_config, #rehash_config

Methods included from Splash::ConfigUtilities

#addservice, #checkconfig, #flush_backend, #setupsplash

Methods included from Splash::Helpers

#check_unicode_term, #daemonize, #format_by_extensions, #format_response, #get_processes, #group_root, #install_file, #is_root?, #make_folder, #make_link, #run_as_root, #search_file_in_gem, #user_root, #verify_file, #verify_folder, #verify_link, #verify_service

Methods included from Splash::Loggers

#change_logger, #get_logger, #get_session

Methods included from Splash::Exiter

#splash_exit, #splash_return

Instance Method Details

#flushbackendObject



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/splash/cli/config.rb', line 54

def flushbackend
  if options[:name] then
    acase = run_as_root :flush_backend, options
  else
    return_cases = {}
    list_backends.each do |key,value|
      return_cases[key] = run_as_root :flush_backend, { :name => key }
    end
    errors = return_cases.select {|key,value| value[:case] != :quiet_exit}.keys
    acase = (errors.empty?)? {:case => :quiet_exit, :more => "All backends flushed successfully"}: {:case => :configuration_error, :more => "Backends #{errors.join(',')} flushing failed"}
  end
  splash_exit acase
end

#sanitycheckObject



28
29
30
31
# File 'lib/splash/cli/config.rb', line 28

def sanitycheck
  acase = run_as_root :checkconfig
  splash_exit acase
end

#serviceObject



45
46
47
48
# File 'lib/splash/cli/config.rb', line 45

def service
  acase = run_as_root :addservice
  splash_exit acase
end

#setupObject



21
22
23
24
# File 'lib/splash/cli/config.rb', line 21

def setup
  acase = run_as_root :setupsplash, options
  splash_exit acase
end

#versionObject



35
36
37
38
39
40
41
# File 'lib/splash/cli/config.rb', line 35

def version
  log = get_logger
  config = get_config
  log.info "Splash version : #{config.version}, Author : #{config.author}"
  log.info config.copyright
  splash_exit case: :quiet_exit
end