class Puppet::SSL::Key::File

Public Instance Methods

allow_remote_requests?() click to toggle source
# File lib/puppet/indirector/key/file.rb, line 10
def allow_remote_requests?
  false
end
destroy(request) click to toggle source

Remove the public key, in addition to the private key

# File lib/puppet/indirector/key/file.rb, line 24
def destroy(request)
  super

  key_path = Puppet::FileSystem.pathname(public_key_path(request.key))
  return unless Puppet::FileSystem.exist?(key_path)

  begin
    Puppet::FileSystem.unlink(key_path)
  rescue => detail
    raise Puppet::Error, "Could not remove #{request.key} public key: #{detail}", detail.backtrace
  end
end
public_key_path(name) click to toggle source

Where should we store the public key?

# File lib/puppet/indirector/key/file.rb, line 15
def public_key_path(name)
  if ca?(name)
    Puppet[:capub]
  else
    File.join(Puppet[:publickeydir], name.to_s + ".pem")
  end
end
save(request) click to toggle source

Save the public key, in addition to the private key.

# File lib/puppet/indirector/key/file.rb, line 38
def save(request)
  super

  begin
    Puppet.settings.setting(:publickeydir).open_file(public_key_path(request.key), 'w') do |f|
      f.print request.instance.content.public_key.to_pem
    end
  rescue => detail
    raise Puppet::Error, "Could not write #{request.key}: #{detail}", detail.backtrace
  end
end