class ForemanRemoteExecutionCore::EffectiveUserMethod
Attributes
effective_user[R]
effective_user_password[R]
password_sent[R]
ssh_user[R]
Public Class Methods
new(effective_user, ssh_user, effective_user_password)
click to toggle source
# File lib/foreman_remote_execution_core/script_runner.rb, line 14 def initialize(effective_user, ssh_user, effective_user_password) @effective_user = effective_user @ssh_user = ssh_user @effective_user_password = effective_user_password.to_s @password_sent = false end
Public Instance Methods
cli_command_prefix()
click to toggle source
# File lib/foreman_remote_execution_core/script_runner.rb, line 40 def cli_command_prefix end
filter_password?(received_data)
click to toggle source
# File lib/foreman_remote_execution_core/script_runner.rb, line 28 def filter_password?(received_data) !@effective_user_password.empty? && @password_sent && received_data.match(Regexp.escape(@effective_user_password)) end
login_prompt()
click to toggle source
# File lib/foreman_remote_execution_core/script_runner.rb, line 43 def login_prompt end
on_data(received_data, ssh_channel)
click to toggle source
# File lib/foreman_remote_execution_core/script_runner.rb, line 21 def on_data(received_data, ssh_channel) if received_data.match(login_prompt) ssh_channel.send_data(effective_user_password + "\n") @password_sent = true end end
reset()
click to toggle source
# File lib/foreman_remote_execution_core/script_runner.rb, line 36 def reset @password_sent = false end
sent_all_data?()
click to toggle source
# File lib/foreman_remote_execution_core/script_runner.rb, line 32 def sent_all_data? effective_user_password.empty? || password_sent end