diff --git a/manifests/classic.pp b/manifests/classic.pp index f3e9704..a7735db 100644 --- a/manifests/classic.pp +++ b/manifests/classic.pp @@ -57,19 +57,16 @@ $joinou = undef, Optional[String] $default_realm = undef, Array $additional_realms = [], -) inherits samba::params{ - - - unless is_domain_name($realm){ +) inherits samba::params { + unless ($realm =~ Variant[Stdlib::Fqdn, Stdlib::Dns::Zone]) { fail('realm must be a valid domain') } - unless is_domain_name($realm){ - fail('realm must be a valid domain') + unless ($smbname =~ String[1,15]) { + fail('smbname too short or too long') } - validate_slength($smbname, 15) - unless is_domain_name("${smbname}.${realm}"){ + unless ("${smbname}.${realm}" =~ Variant[Stdlib::Fqdn, Stdlib::Dns::Zone]) { fail('smbname must be a valid domain') } @@ -94,6 +91,12 @@ $_default_realm = pick($default_realm, $realmuppercase) + if $manage_winbind { + $services_to_notify = ['SambaSmb', 'SambaWinBind'] + } + else { + $services_to_notify = ['SambaSmb'] + } file { '/etc/samba/': ensure => 'directory', @@ -111,7 +114,7 @@ ensure => present, mode => '0644', content => template("${module_name}/krb5.conf.erb"), - notify => Service['SambaSmb', 'SambaWinBind'], + notify => Service[$services_to_notify]; } } @@ -281,12 +284,6 @@ $mandatoryglobaloptionsindex = prefix(keys($mandatoryglobaloptions), '[global]') - if $manage_winbind { - $services_to_notify = ['SambaSmb', 'SambaWinBind'] - } - else { - $services_to_notify = ['SambaSmb'] - } samba::option{ $mandatoryglobaloptionsindex: options => $mandatoryglobaloptions, section => 'global', diff --git a/manifests/dc.pp b/manifests/dc.pp index d1859a6..299d810 100644 --- a/manifests/dc.pp +++ b/manifests/dc.pp @@ -105,7 +105,7 @@ fail("role must be in [${checkrolestr}]") } - unless is_domain_name($realm){ + unless ($realm =~ Variant[Stdlib::Fqdn, Stdlib::Dns::Zone]) { fail('realm must be a valid domain') } diff --git a/manifests/dc/ppolicy_param.pp b/manifests/dc/ppolicy_param.pp index f89ccd3..8e18eb3 100644 --- a/manifests/dc/ppolicy_param.pp +++ b/manifests/dc/ppolicy_param.pp @@ -6,20 +6,18 @@ String $value, ){ - validate_re( - $option, - '^--.*$', - "option must start with '--' and be \ + if $option !~ /^--.*$/ { + fail("option must start with '--' and be \ a valid 'samba-tool domain passwordsettings' option", - ) + ) + } - validate_re( - $show_string, - '^.*:$', - "show_string must end with ':' \ + if $show_string !~ /^.*:$/ { + fail("show_string must end with ':' \ and be the string in 'samba-tool domain passwordsettings show' \ corresponding to option", - ) + ) + } exec{"cmd_ppolicy_param ${option}": path => '/bin:/sbin:/usr/bin:/usr/sbin', diff --git a/manifests/log.pp b/manifests/log.pp index bf72d0f..b05ba6a 100644 --- a/manifests/log.pp +++ b/manifests/log.pp @@ -11,7 +11,7 @@ $classliststr = join($classlist, ', ') if $sambaclassloglevel != undef { - unless is_hash($sambaclassloglevel) + unless $sambaclassloglevel =~ Hash and difference(keys($sambaclassloglevel), $classlist) == [] { fail("sambaclassloglevel must be a hash with keys in [${classliststr}]") } diff --git a/metadata.json b/metadata.json index 67e88a4..fb4cafc 100644 --- a/metadata.json +++ b/metadata.json @@ -11,7 +11,7 @@ "dependencies": [ { "name": "puppetlabs-stdlib", - "version_requirement": ">= 3.0.0 < 5.0.0" + "version_requirement": ">= 9.0.0 < 9.4.0" }, { "name": "herculesteam-augeasproviders_pam", @@ -43,8 +43,8 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04", - "16.04" + "20.04", + "21.04" ] }, { @@ -54,7 +54,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.10.0 < 6.0.0" + "version_requirement": ">= 6.0.0 < 9.0.0" } ] }