Skip to content

Commit

Permalink
Merge pull request djjudas21#198 from pixelpark/use_name_instead_of_s…
Browse files Browse the repository at this point in the history
…hortname

Use name instead of shortname for client definition
  • Loading branch information
djjudas21 authored Aug 16, 2023
2 parents f36ac50 + 4c86f3c commit 31db98a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
$fr_basepath = $::freeradius::params::fr_basepath
$fr_group = $::freeradius::params::fr_group

file { "${fr_basepath}/clients.d/${shortname}.conf":
file { "${fr_basepath}/clients.d/${name}.conf":
ensure => $ensure,
mode => '0640',
owner => 'root',
Expand All @@ -61,14 +61,14 @@

if $port {
if $ip {
firewall { "100 ${shortname} ${port_description} v4":
firewall { "100 ${name} ${port_description} v4":
proto => 'udp',
dport => $port,
action => 'accept',
source => $ip,
}
} elsif $ip6 {
firewall { "100 ${shortname} ${port_description} v6":
firewall { "100 ${name} ${port_description} v6":
proto => 'udp',
dport => $port,
action => 'accept',
Expand All @@ -83,7 +83,7 @@

if $huntgroups {
$huntgroups.each |$index, $huntgroup| {
freeradius::huntgroup { "huntgroup.client.${shortname}.${index}":
freeradius::huntgroup { "huntgroup.client.${name}.${index}":
* => $huntgroup
}
}
Expand Down
16 changes: 8 additions & 8 deletions spec/defines/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
end

it do
is_expected.to contain_file('/etc/raddb/clients.d/test_short.conf')
is_expected.to contain_file('/etc/raddb/clients.d/test.conf')
.with_content(%r{^client test_short {\n\s+ipaddr = 1.2.3.4\n\s+proto = \*\n\s+shortname = test_short\n\s+secret = "secret_value"\n\s+require_message_authenticator = no\n}\n})
.with_ensure('present')
.with_group('radiusd')
Expand Down Expand Up @@ -57,7 +57,7 @@
end

it do
is_expected.to contain_file('/etc/raddb/clients.d/test_short.conf')
is_expected.to contain_file('/etc/raddb/clients.d/test.conf')
.with_content(%r{^\s+password = "foo bar"$})
end
end
Expand All @@ -81,7 +81,7 @@
end

it do
is_expected.to contain_firewall('100 test_short 1234 v4')
is_expected.to contain_firewall('100 test 1234 v4')
.with_proto('udp')
.with_dport(1234)
.with_action('accept')
Expand All @@ -96,9 +96,9 @@
end

it do
is_expected.not_to contain_firewall('100 test_short 1234 v4')
is_expected.not_to contain_firewall('100 test 1234 v4')

is_expected.to contain_firewall('100 test_short 1234 v6')
is_expected.to contain_firewall('100 test 1234 v6')
.with_proto('udp')
.with_dport(1234)
.with_action('accept')
Expand All @@ -116,7 +116,7 @@
end

it do
is_expected.to contain_firewall('100 test_short 1234,4321 v4')
is_expected.to contain_firewall('100 test 1234,4321 v4')
.with_proto('udp')
.with_dport([1234, 4321])
.with_action('accept')
Expand All @@ -131,9 +131,9 @@
end

it do
is_expected.not_to contain_firewall('100 test_short 1234,4321 v4')
is_expected.not_to contain_firewall('100 test 1234,4321 v4')

is_expected.to contain_firewall('100 test_short 1234,4321 v6')
is_expected.to contain_firewall('100 test 1234,4321 v6')
.with_proto('udp')
.with_dport([1234, 4321])
.with_action('accept')
Expand Down

0 comments on commit 31db98a

Please sign in to comment.