From a5a347e3398bdd245b3fe2721771de5393e55ca2 Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Fri, 18 Aug 2023 14:29:08 +1200 Subject: [PATCH] allow package_ensure to specify specific versions, rather than just latest etc. --- manifests/init.pp | 4 ++-- spec/classes/postfix_spec.rb | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index bfab9c5..a83b65f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,7 +16,7 @@ # A hash of config key-value entries for master.cf # # @param package_ensure -# The state the postfix package should be ensured. +# The state or version the postfix package should be ensured. # # @param package_manage # Whether to install the postfix and plugin packages. @@ -59,7 +59,7 @@ Enum['installed', 'present', 'latest'] $mailx_ensure, Boolean $mailx_manage, String $mailx_package, - Enum['installed', 'present', 'latest'] $package_ensure, + Variant[String,Enum['installed', 'present', 'latest']] $package_ensure, Boolean $package_manage, String $package_name, Hash $plugin, diff --git a/spec/classes/postfix_spec.rb b/spec/classes/postfix_spec.rb index 4ade7aa..5085ee0 100644 --- a/spec/classes/postfix_spec.rb +++ b/spec/classes/postfix_spec.rb @@ -31,6 +31,12 @@ it { is_expected.not_to contain_service('postfix') } end + + context 'with version string' do + let(:params) { { package_ensure: '1.2.3-4.el5' } } + + it { is_expected.to contain_package('postfix').with_ensure('1.2.3-4.el5') } + end end end end