class RHC::Rest::Key

Public Instance Methods

delete() click to toggle source
Alias for: destroy
destroy() click to toggle source
# File lib/rhc/rest/key.rb, line 13
def destroy
  debug "Deleting key #{self.name}"
  rest_method "DELETE"
end
Also aliased as: delete
fingerprint() click to toggle source
# File lib/rhc/rest/key.rb, line 19
def fingerprint
  @fingerprint ||= begin
    public_key = Net::SSH::KeyFactory.load_data_public_key("#{type} #{content}")
    public_key.fingerprint
  rescue NotImplementedError, OpenSSL::PKey::PKeyError => e
    'Invalid key'
  end
end
update(type, content) click to toggle source
# File lib/rhc/rest/key.rb, line 8
def update(type, content)
  debug "Updating key #{self.name}"
  rest_method "UPDATE", :type => type, :content => content
end
visible_to_ssh?() click to toggle source
# File lib/rhc/rest/key.rb, line 28
def visible_to_ssh?
  Net::SSH::Authentication::Agent.connect.identities.
    find{ |i| fingerprint == i.fingerprint }.present? rescue false
end