class Chef::Resource::SshKnownHostsEntry

Public Instance Methods

key_exists?(keys, key, comment) click to toggle source
# File lib/chef/resource/ssh_known_hosts_entry.rb, line 142
def key_exists?(keys, key, comment)
  keys.any? do |line|
    line.match(/#{Regexp.escape(comment)}|#{Regexp.escape(key)}/)
  end
end
type_string(key_type) click to toggle source
# File lib/chef/resource/ssh_known_hosts_entry.rb, line 148
def type_string(key_type)
  type_map = {
    "rsa" => "ssh-rsa",
    "dsa" => "ssh-dss",
    "ecdsa" => "ecdsa-sha2-nistp256",
    "ed25519" => "ssh-ed25519",
  }
  type_map[key_type] || key_type
end