aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGabriel Nagy <gabriel.nagy@puppet.com>2020-05-27 17:01:20 +0300
committerGabriel Nagy <gabriel.nagy@puppet.com>2020-05-27 17:41:49 +0300
commit2e059d49fbd48d0c4897518941f6a2b65785852a (patch)
tree1cc75fa35c2595f39e54514f75812dd6c2b634ca /lib
parent9b2d2aab210360b785370cd982f50ba5ffd2b53f (diff)
downloadpuppet-sshkeys_core-2e059d49fbd48d0c4897518941f6a2b65785852a.tar.gz
puppet-sshkeys_core-2e059d49fbd48d0c4897518941f6a2b65785852a.tar.bz2
(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`.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/provider/sshkey/parsed.rb4
-rw-r--r--lib/puppet/type/sshkey.rb4
2 files changed, 8 insertions, 0 deletions
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
[
[