Class: SSHKit::Backend::Netssh::KnownHosts
- Inherits:
-
Object
- Object
- SSHKit::Backend::Netssh::KnownHosts
- Includes:
- Mutex_m
- Defined in:
- lib/sshkit/backends/netssh/known_hosts.rb
Instance Method Summary collapse
- #add(*args) ⇒ Object
-
#initialize ⇒ KnownHosts
constructor
A new instance of KnownHosts.
- #search_for(host, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ KnownHosts
Returns a new instance of KnownHosts.
117 118 119 120 |
# File 'lib/sshkit/backends/netssh/known_hosts.rb', line 117 def initialize super() @files = {} end |
Instance Method Details
#add(*args) ⇒ Object
129 130 131 132 |
# File 'lib/sshkit/backends/netssh/known_hosts.rb', line 129 def add(*args) ::Net::SSH::KnownHosts.add(*args) synchronize { @files = {} } end |
#search_for(host, options = {}) ⇒ Object
122 123 124 125 126 127 |
# File 'lib/sshkit/backends/netssh/known_hosts.rb', line 122 def search_for(host, = {}) keys = ::Net::SSH::KnownHosts.hostfiles().map do |path| known_hosts_file(path).keys_for(host) end.flatten ::Net::SSH::HostKeys.new(keys, host, self, ) end |