Class: ProxyAPI::RemoteExecutionSSH

Inherits:
Resource
  • Object
show all
Defined in:
app/lib/proxy_api/remote_execution_ssh.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ RemoteExecutionSSH

Returns a new instance of RemoteExecutionSSH.



3
4
5
6
# File 'app/lib/proxy_api/remote_execution_ssh.rb', line 3

def initialize(args)
  @url = args[:url] + '/ssh'
  super args
end

Instance Method Details

#ca_pubkeyObject



14
15
16
17
18
19
20
21
# File 'app/lib/proxy_api/remote_execution_ssh.rb', line 14

def ca_pubkey
  get('ca_pubkey')&.strip
rescue RestClient::ResourceNotFound => e
  Rails.logger.warn(format(N_("Unable to fetch CA public key: %{error}"), error: e.message))
  nil
rescue => e
  raise ProxyException.new(url, e, N_('Unable to fetch CA public key'))
end

#drop_from_known_hosts(hostname) ⇒ Object



23
24
25
26
27
# File 'app/lib/proxy_api/remote_execution_ssh.rb', line 23

def drop_from_known_hosts(hostname)
  delete('known_hosts/' + hostname)
rescue => e
  raise ProxyException.new(url, e, N_('Unable to remove host from known hosts'))
end

#pubkeyObject



8
9
10
11
12
# File 'app/lib/proxy_api/remote_execution_ssh.rb', line 8

def pubkey
  get('pubkey').strip
rescue => e
  raise ProxyException.new(url, e, N_('Unable to fetch public key'))
end