From 2e059d49fbd48d0c4897518941f6a2b65785852a Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 27 May 2020 17:01:20 +0300 Subject: (PUP-10510) Fix sshkeys not being correctly purged After adding support for composite namevars in version 2.0.0, the module lost the ability to purge sshkeys. This happens due to Puppet being unable to correctly match the names and types of the sshkeys to be purged. Part of the fix was done in https://github.com/puppetlabs/puppet/pull/8174, which changes how a resource is initialized if the provider implements a `title` method. Additionally, we add the key name and type to be included in the output shown by `puppet resource`. --- lib/puppet/provider/sshkey/parsed.rb | 4 ++++ lib/puppet/type/sshkey.rb | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/puppet/provider/sshkey/parsed.rb b/lib/puppet/provider/sshkey/parsed.rb index 965c20d..3ed0873 100644 --- a/lib/puppet/provider/sshkey/parsed.rb +++ b/lib/puppet/provider/sshkey/parsed.rb @@ -28,6 +28,10 @@ Puppet::Type.type(:sshkey).provide( 0o644 end + def title + "#{property_hash[:name]}@#{property_hash[:type]}" + end + def self.default_target case Facter.value(:operatingsystem) when 'Darwin' diff --git a/lib/puppet/type/sshkey.rb b/lib/puppet/type/sshkey.rb index c3cce5d..6c7e428 100644 --- a/lib/puppet/type/sshkey.rb +++ b/lib/puppet/type/sshkey.rb @@ -12,6 +12,10 @@ module Puppet "#{self[:name]}@#{self[:type]}" end + def self.parameters_to_include + [:name, :type] + end + def self.title_patterns [ [ -- cgit v1.2.3