Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replaced deprecated stdlib functions #77

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
replaced deprecated stdlib functions
Michiel Brandenburg committed Sep 12, 2023
commit eb51d11e9b857df1bc85d0d500af236424599926
13 changes: 5 additions & 8 deletions manifests/classic.pp
Original file line number Diff line number Diff line change
@@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my recommendation is to add the datatypes to the class parameters,that makes the whole file shorter and enabled puppet-strings to pick up the types for the automatic documentation.

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')
}

2 changes: 1 addition & 1 deletion manifests/dc.pp
Original file line number Diff line number Diff line change
@@ -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')
}

18 changes: 8 additions & 10 deletions manifests/dc/ppolicy_param.pp
Original file line number Diff line number Diff line change
@@ -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',
8 changes: 4 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}