Module: Proxy::RemoteExecution::Ssh

Defined in:
lib/smart_proxy_remote_execution_ssh_core.rb,
lib/smart_proxy_remote_execution_ssh_core/session.rb,
lib/smart_proxy_remote_execution_ssh_core/version.rb,
lib/smart_proxy_remote_execution_ssh_core/settings.rb,
lib/smart_proxy_remote_execution_ssh_core/connector.rb,
lib/smart_proxy_remote_execution_ssh_core/dispatcher.rb,
lib/smart_proxy_remote_execution_ssh_core/command_action.rb,
lib/smart_proxy_remote_execution_ssh_core/command_update.rb

Defined Under Namespace

Modules: Core Classes: CommandAction, CommandUpdate, Connector, Dispatcher, Session, Settings

Class Method Summary collapse

Class Method Details

.dispatcherObject



33
34
35
# File 'lib/smart_proxy_remote_execution_ssh_core.rb', line 33

def dispatcher
  @dispatcher || initialize
end

.initializeObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/smart_proxy_remote_execution_ssh_core.rb', line 14

def initialize
  unless private_key_file
    raise "settings for `ssh_identity_key` not set"
  end

  unless File.exist?(private_key_file)
    raise "Ssh public key file #{private_key_file} doesn't exist.\n"\
      "You can generate one with `ssh-keygen -t rsa -b 4096 -f #{private_key_file} -N ''`"
  end

  unless File.exist?(public_key_file)
    raise "Ssh public key file #{public_key_file} doesn't exist"
  end

  @dispatcher = Proxy::RemoteExecution::Ssh::Dispatcher.spawn('proxy-ssh-dispatcher',
                                                              :clock  => SmartProxyDynflowCore::Core.instance.world.clock,
                                                              :logger => SmartProxyDynflowCore::Core.instance.world.logger)
end

.private_key_fileObject



37
38
39
# File 'lib/smart_proxy_remote_execution_ssh_core.rb', line 37

def private_key_file
  File.expand_path(Settings.instance.ssh_identity_key_file)
end

.public_key_fileObject



41
42
43
# File 'lib/smart_proxy_remote_execution_ssh_core.rb', line 41

def public_key_file
  File.expand_path("#{private_key_file}.pub")
end