With #432 the $ensure parameter's type in ssh::server was changed to String. But this change has not been respected with the latest changes to $service_ensure which came with v15.0.0.
The default value for this parameter is only automatically set if $ensure is set to either "present" or "absent". If you set it to "latest" or a specific package version (which was the reason for allowing any string value), this is not working and leads to the following error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: No matching entry for selector parameter with value 'latest' (file: /etc/puppetlabs/code/environments/production/modules/ssh/manifests/server.pp, line: 136, column: 60) on node
The automatic default value selection should therefore be changed accordingly. This should be pretty easy since there are still only two different situations regarding the value of $ensure:
- It's set to "absent" or "purged". Then $service_ensure should obviously be set to "stopped".
- With any other value ("present", "latest", "disabled" or some specific version) the value of $service_ensure should be "running".
So this can be fixed with the following change:
diff --git a/manifests/server.pp b/manifests/server.pp
index 9d68cab..823bc99 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -135,3 +135,3 @@ class ssh::server (
String $ensure = present,
- Stdlib::Ensure::Service $service_ensure = $ensure ? { 'present' => 'running', 'absent' => 'stopped' },
+ Stdlib::Ensure::Service $service_ensure = $ensure ? { /(absent|purged|disabled)/ => 'stopped', default => 'running' },
Boolean $service_enable = ($service_ensure == 'running'),
With #432 the $ensure parameter's type in
ssh::serverwas changed to String. But this change has not been respected with the latest changes to $service_ensure which came with v15.0.0.The default value for this parameter is only automatically set if $ensure is set to either "present" or "absent". If you set it to "latest" or a specific package version (which was the reason for allowing any string value), this is not working and leads to the following error:
The automatic default value selection should therefore be changed accordingly. This should be pretty easy since there are still only two different situations regarding the value of $ensure:
So this can be fixed with the following change: