diff --git a/manifests/ca.pp b/manifests/ca.pp index c56618e..0306df5 100644 --- a/manifests/ca.pp +++ b/manifests/ca.pp @@ -34,19 +34,16 @@ # } define ca_cert::ca ( - $ca_text = undef, - $source = 'text', - $ensure = 'trusted', - $verify_https_cert = true, - $checksum = undef, - $ca_file_mode = $ca_cert::params::ca_file_mode, + Optional[String] $ca_text = undef, + String $source = 'text', + String $ensure = 'trusted', + Boolean $verify_https_cert = true, + Optional[String] $checksum = undef, + String $ca_file_mode = $ca_cert::params::ca_file_mode, ) { include ::ca_cert::params - validate_string($source) - validate_bool($verify_https_cert) - if ($ensure == 'trusted' or $ensure == 'distrusted') and $source == 'text' and !is_string($ca_text) { fail('ca_text is required if source is set to text') } diff --git a/manifests/init.pp b/manifests/init.pp index 47af1da..31138da 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -37,20 +37,17 @@ # Phil Fenstermacher # class ca_cert ( - $always_update_certs = false, - $purge_unmanaged_CAs = false, - $install_package = true, - $ca_certs = {}, - $package_ensure = present, - $package_name = $ca_cert::params::package_name, + Boolean $always_update_certs = false, + Boolean $purge_unmanaged_CAs = false, + Boolean $install_package = true, + Hash $ca_certs = {}, + String $package_ensure = present, + String $package_name = $ca_cert::params::package_name, ) inherits ca_cert::params { include ::ca_cert::params include ::ca_cert::update - validate_bool($always_update_certs) - validate_hash($ca_certs) - if $always_update_certs == true { Exec <| title=='ca_cert_update' |> { refreshonly => false, diff --git a/spec/classes/ca_cert_spec.rb b/spec/classes/ca_cert_spec.rb index 7628f2e..00b1317 100644 --- a/spec/classes/ca_cert_spec.rb +++ b/spec/classes/ca_cert_spec.rb @@ -30,7 +30,7 @@ context "with purge_unmanaged_CAs set to true" do let :params do { - :purge_unmanaged_CAs => 'true', + :purge_unmanaged_CAs => true, } end it { is_expected.to contain_file("trusted_certs").with( @@ -65,7 +65,7 @@ context "with purge_unmanaged_CAs set to true" do let :params do { - :purge_unmanaged_CAs => 'true', + :purge_unmanaged_CAs => true, } end it { is_expected.to contain_file("trusted_certs").with( @@ -102,7 +102,7 @@ context "with purge_unmanaged_CAs set to true" do let :params do { - :purge_unmanaged_CAs => 'true', + :purge_unmanaged_CAs => true, } end it { is_expected.to contain_file("trusted_certs").with( @@ -139,7 +139,7 @@ context "with purge_unmanaged_CAs set to true" do let :params do { - :purge_unmanaged_CAs => 'true', + :purge_unmanaged_CAs => true, } end it { is_expected.to contain_file("trusted_certs").with(