module ForemanRemoteExecutionCore
rubocop:enable Lint/HandleExceptions:
Constants
- SSH_LOG_LEVELS
- VERSION
Public Class Methods
runner_class()
click to toggle source
# File lib/foreman_remote_execution_core.rb, line 51 def self.runner_class @runner_class ||= if simulate? FakeScriptRunner elsif settings[:async_ssh] PollingScriptRunner else ScriptRunner end end
simulate?()
click to toggle source
# 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!()
click to toggle source
Calls superclass method
# 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!()
click to toggle source
# 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?(SmartProxyDynflowCore) SmartProxyDynflowCore::SETTINGS.log_level.to_s.downcase else Rails.configuration.log_level.to_s end # regular log levels correspond to upcased ssh logger levels 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