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

Remove is_ip_address function removed from stdlib in 9.x #217

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
31 changes: 11 additions & 20 deletions manifests/listen.pp
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
# == Define freeradius::listen
#
define freeradius::listen (
Freeradius::Ensure $ensure = 'present',
Enum['auth','acct','proxy','detail','status','coa'] $type = 'auth',
Optional[String] $ip = undef,
Optional[String] $ip6 = undef,
Integer $port = 0,
Optional[String] $interface = undef,
Optional[String] $virtual_server = undef,
Array[String] $clients = [],
Integer $max_connections = 16,
Integer $lifetime = 0,
Integer $idle_timeout = 30,
Freeradius::Ensure $ensure = 'present',
Enum['auth','acct','proxy','detail','status','coa'] $type = 'auth',
Optional[Variant[Stdlib::IP::Address::V4, Enum['*']]] $ip = undef,
Optional[Variant[Stdlib::IP::Address::V6, Enum['*']]] $ip6 = undef,
Integer $port = 0,
Optional[String] $interface = undef,
Optional[String] $virtual_server = undef,
Array[String] $clients = [],
Integer $max_connections = 16,
Integer $lifetime = 0,
Integer $idle_timeout = 30,
) {
$fr_basepath = $::freeradius::params::fr_basepath
$fr_group = $::freeradius::params::fr_group

# Parameter validation
if $ip and $ip != '*' and !is_ip_address($ip) {
fail('ip must be a valid IP address or \'*\'')
}

if $ip6 and $ip6 != '::' and !is_ip_address($ip6) {
fail('ip6 must be a valid IP address or \'::\'')
}

if $ip and $ip6 {
fail('Only one of ip or ip6 can be used')
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">=4.25.0 <10.0.0"
"version_requirement": ">=5.0.0 <10.0.0"
},
{
"name": "puppetlabs/firewall",
Expand Down
Loading