Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unused privkey, pubkey and key_bundle types & providers #462

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 0 additions & 60 deletions lib/puppet/provider/katello_ssl_tool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,64 +86,4 @@ def ca_details
end
end
end

class CertFile < Puppet::Provider

initvars

commands :openssl => 'openssl'

def exists?
return false unless File.exist?(resource[:path])
return false unless File.exist?(source_path)
expected_content_processed == current_content
end

def create
File.open(resource[:path], "w", mode) { |f| f << expected_content_processed }
end

def destroy
FileUtils.rm_f(resource[:path])
end

protected

def expected_content_processed
content = expected_content
if resource[:force_rsa]
content.gsub!(/(BEGIN|END) (PRIVATE KEY)/, '\1 RSA \2')
end
content
end

def expected_content
File.read(source_path)
end

def current_content
File.read(resource[:path])
end

# what path to copy from
def source_path
raise NotImplementedError
end

def mode
0644
end

def cert_details
return @cert_details if defined? @cert_details
if cert_resource = resource.catalog.resource(@resource[:key_pair].to_s)
name = cert_resource.to_hash[:name]
@cert_details = details(name)
else
raise 'Cert or Ca was not specified'
end
end

end

end
39 changes: 0 additions & 39 deletions lib/puppet/provider/key_bundle/katello_ssl_tool.rb

This file was deleted.

37 changes: 0 additions & 37 deletions lib/puppet/provider/privkey/katello_ssl_tool.rb

This file was deleted.

20 changes: 0 additions & 20 deletions lib/puppet/provider/pubkey/katello_ssl_tool.rb

This file was deleted.

14 changes: 0 additions & 14 deletions lib/puppet/type/key_bundle.rb

This file was deleted.

10 changes: 0 additions & 10 deletions lib/puppet/type/privkey.rb

This file was deleted.

10 changes: 0 additions & 10 deletions lib/puppet/type/pubkey.rb

This file was deleted.

68 changes: 0 additions & 68 deletions lib/puppet_x/certs/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,74 +67,6 @@ module Common
[self[:password_file]].compact
end
end

FILE_COMMON_PARAMS = Proc.new do
ensurable

newparam(:path, :namevar => true) do
isrequired
end

newparam(:password_file)

# ensure RSA string is present in -----(BEGIN/END) (RSA )?PRIVATE KEY-----
newparam(:force_rsa)

# make ensure present default
define_method(:managed?) { true }

newparam(:key_pair) do
isrequired

validate do |value|
param_resource = resource.catalog.resource(value.to_s)

if param_resource
param_resource_type = if param_resource.is_a?(Puppet::Resource)
param_resource.resource_type
else
param_resource.to_resource.resource_type
end

unless ['Puppet::Type::Ca', 'Puppet::Type::Cert'].include?(param_resource_type.to_s)
raise ArgumentError, "Expected Ca or Cert resource, got #{param_resource_type} #{param_resource.inspect}"
end
end
end
end

define_method(:autorequire_cert) do |type|
if @parameters.has_key?(:key_pair)
key_pair = catalog.resource(@parameters[:key_pair].value.to_s)
key_pair.to_hash[:name] if key_pair && key_pair.type == type
end
end

autorequire(:cert) do
autorequire_cert('Cert')
end

autorequire(:ca) do
autorequire_cert('Ca')
end

# Autorequire the nearest ancestor directory found in the catalog.
# Copied from Puppet's lib/puppet/type/file.rb
autorequire(:file) do
req = []
req << self[:password_file] if self[:password_file]
path = Pathname.new(self[:path])
if !path.root?
# Start at our parent, to avoid autorequiring ourself
parents = path.parent.enum_for(:ascend)
found = parents.find { |p| catalog.resource(:file, p.to_s) }
if found
req << found.to_s
end
end
req
end
end
end
end
end
26 changes: 0 additions & 26 deletions spec/types/key_bundle_spec.rb

This file was deleted.

26 changes: 0 additions & 26 deletions spec/types/privkey_spec.rb

This file was deleted.

26 changes: 0 additions & 26 deletions spec/types/pubkey_spec.rb

This file was deleted.

Loading