# File lib/rhc/commands/sshkey.rb, line 43 def add(name, key) type, content, comment = ssh_key_triple_for(key) # validate the user input before sending it to the server begin Net::SSH::KeyFactory.load_data_public_key "#{type} #{content}" rescue NotImplementedError, OpenSSL::PKey::PKeyError, Net::SSH::Exception => e debug e.inspect if options.confirm warn 'The key you are uploading is not recognized. You may not be able to authenticate to your application through Git or SSH.' else raise ::RHC::KeyDataInvalidException.new("File '#{key}' does not appear to be a recognizable key file (#{e}). You may specify the '--confirm' flag to add the key anyway.") end end rest_client.add_key(name, content, type) results { say "SSH key #{key} has been added as '#{name}'" } 0 end
# File lib/rhc/commands/sshkey.rb, line 15 def list keys = rest_client.sshkeys results do result = keys.inject('') do |r, key| r += format(key, erb) end say result end 0 end
Generated with the Darkfish Rdoc Generator 2.