hbui
02/21/2025, 7:10 PMis_domain_name function from stdlib and running into issues that don't make sense.
I'm trying to use stdlib::validate_domain_name() to validate something that used to work and it is claiming that it is invalid an an if
class bar {
$domains = [
'<http://dept1.example.edu|dept1.example.edu>',
'<http://sub.dept2.example.edu|sub.dept2.example.edu>',
'<http://dept3.example.edu|dept3.example.edu>',
'<http://dept4.example.edu|dept4.example.edu>',
'<http://dept2.example.edu|dept2.example.edu>',
]
$domains.each | String $domain | {
if $domain =~ Stdlib::Fqdn {
notify { "${domain} is a Stdlib::Fqdn": }
} else {
notify { "${domain} is NOT a Stdlib::Fqdn": }
}
if stdlib::validate_domain_name($domain) {
notify { "${domain} is a stdlib::validate_domain_name": }
} else {
notify { "${domain} is NOT a stdlib::validate_domain_name": }
}
}
}
when I run it through pdk test unit, I get these resources
Notify[<http://dept1.example.edu|dept1.example.edu> is NOT a stdlib::validate_domain_name]
Notify[<http://dept1.example.edu|dept1.example.edu> is a Stdlib::Fqdn]
Notify[<http://dept2.example.edu|dept2.example.edu> is NOT a stdlib::validate_domain_name]
Notify[<http://dept2.example.edu|dept2.example.edu> is a Stdlib::Fqdn]
Notify[<http://dept3.example.edu|dept3.example.edu> is NOT a stdlib::validate_domain_name]
Notify[<http://dept3.example.edu|dept3.example.edu> is a Stdlib::Fqdn]
Notify[<http://dept4.example.edu|dept4.example.edu> is NOT a stdlib::validate_domain_name]
Notify[<http://dept4.example.edu|dept4.example.edu> is a Stdlib::Fqdn]
Notify[<http://sub.dept2.example.edu|sub.dept2.example.edu> is NOT a stdlib::validate_domain_name]
Notify[<http://sub.dept2.example.edu|sub.dept2.example.edu> is a Stdlib::Fqdn]
I thought the whole point of stdlib::validate_domain_name was to check to see if it was either a Stdlib::Fqdn or a Stdlib:Dns:Zone type.
What am I missing?