Module: ForemanRemoteExecutionCore
- Extended by:
- ForemanTasksCore::SettingsLoader
- Defined in:
- lib/foreman_remote_execution_core/script_runner.rb,
lib/foreman_remote_execution_core.rb,
lib/foreman_remote_execution_core/utils.rb,
lib/foreman_remote_execution_core/actions.rb,
lib/foreman_remote_execution_core/version.rb,
lib/foreman_remote_execution_core/dispatcher.rb,
lib/foreman_remote_execution_core/log_filter.rb,
lib/foreman_remote_execution_core/fake_script_runner.rb,
lib/foreman_remote_execution_core/polling_script_runner.rb
Overview
rubocop:enable Lint/SuppressedException:
Defined Under Namespace
Modules: Actions, Utils
Classes: Dispatcher, DzdoUserMethod, EffectiveUserMethod, FakeScriptRunner, LogFilter, NoopUserMethod, PollingScriptRunner, ScriptRunner, SuUserMethod, SudoUserMethod
Constant Summary
collapse
- SSH_LOG_LEVELS =
%w(debug info warn error fatal).freeze
- VERSION =
'1.4.7'.freeze
Class Method Summary
collapse
Class Method Details
.simulate? ⇒ Boolean
19
20
21
|
# File 'lib/foreman_remote_execution_core.rb', line 19
def self.simulate?
%w(yes true 1).include? ENV.fetch('REX_SIMULATE', '').downcase
end
|
.validate_settings! ⇒ Object
23
24
25
26
27
|
# File 'lib/foreman_remote_execution_core.rb', line 23
def self.validate_settings!
super
self.validate_ssh_log_level!
@settings[:ssh_log_level] = @settings[:ssh_log_level].to_sym
end
|
.validate_ssh_log_level! ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/foreman_remote_execution_core.rb', line 29
def self.validate_ssh_log_level!
wanted_level = @settings[:ssh_log_level].to_s
unless SSH_LOG_LEVELS.include? wanted_level
raise "Wrong value '#{@settings[:ssh_log_level]}' for ssh_log_level, must be one of #{SSH_LOG_LEVELS.join(', ')}"
end
current = if defined?(::Proxy::SETTINGS)
::Proxy::SETTINGS.log_level.to_s.downcase
elsif defined?(SmartProxyDynflowCore::SETTINGS)
SmartProxyDynflowCore::SETTINGS.log_level.to_s.downcase
else
Rails.configuration.log_level.to_s
end
ssh, regular = [wanted_level, current].map do |wanted|
SSH_LOG_LEVELS.each_with_index.find { |value, _index| value == wanted }.last
end
if ssh < regular
raise 'ssh_log_level cannot be more verbose than regular log level'
end
end
|