Loading spec/defines/module/ldap_spec.rb +17 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ describe 'freeradius::module::ldap' do .with_content(%r{^\s+identity = 'cn=root,dc=example,dc=com'\n}) .with_content(%r{^\s+password = 'test password'\n}) .with_content(%r{^\s+base_dn = 'dc=example,dc=com'\n}) .with_content(%r{^\s+update \{\n}) .without_content(%r{^\s+connect_timeout = .*}) .with_ensure('present') .with_group('radiusd') Loading Loading @@ -146,4 +147,20 @@ describe 'freeradius::module::ldap' do is_expected.to compile.and_raise_error(%r{parameter 'password' expects a match for Freeradius::Password}) end end context 'with update passed' do let(:params) do super().merge( update: [ "reply:Framed-IP-Address := 'radiusFramedIPAddress'", "control:Password-With-Header += 'userPassword'", ], ) end it do is_expected.to contain_file('/etc/raddb/mods-available/test') .with_content(%r{^\s+update \{\n\s+control:Password-With-Header \+= 'userPassword'\n\s+reply:Framed-IP-Address := 'radiusFramedIPAddress'\n\s+\}\n}) end end end templates/ldap.erb +3 −3 Original line number Diff line number Diff line Loading @@ -162,16 +162,16 @@ ldap <%= @name %> { # request: += 'radiusRequestAttribute' # reply: += 'radiusReplyAttribute' # } update { <%- if @update -%> <%= @update.join("\n ") %> <%= @update.sort.join("\n ") %> <%- else -%> update { control:Password-With-Header += 'userPassword' control: += 'radiusControlAttribute' request: += 'radiusRequestAttribute' reply: += 'radiusReplyAttribute' } <%- end -%> } # Set to yes if you have eDirectory and want to use the universal Loading Loading
spec/defines/module/ldap_spec.rb +17 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ describe 'freeradius::module::ldap' do .with_content(%r{^\s+identity = 'cn=root,dc=example,dc=com'\n}) .with_content(%r{^\s+password = 'test password'\n}) .with_content(%r{^\s+base_dn = 'dc=example,dc=com'\n}) .with_content(%r{^\s+update \{\n}) .without_content(%r{^\s+connect_timeout = .*}) .with_ensure('present') .with_group('radiusd') Loading Loading @@ -146,4 +147,20 @@ describe 'freeradius::module::ldap' do is_expected.to compile.and_raise_error(%r{parameter 'password' expects a match for Freeradius::Password}) end end context 'with update passed' do let(:params) do super().merge( update: [ "reply:Framed-IP-Address := 'radiusFramedIPAddress'", "control:Password-With-Header += 'userPassword'", ], ) end it do is_expected.to contain_file('/etc/raddb/mods-available/test') .with_content(%r{^\s+update \{\n\s+control:Password-With-Header \+= 'userPassword'\n\s+reply:Framed-IP-Address := 'radiusFramedIPAddress'\n\s+\}\n}) end end end
templates/ldap.erb +3 −3 Original line number Diff line number Diff line Loading @@ -162,16 +162,16 @@ ldap <%= @name %> { # request: += 'radiusRequestAttribute' # reply: += 'radiusReplyAttribute' # } update { <%- if @update -%> <%= @update.join("\n ") %> <%= @update.sort.join("\n ") %> <%- else -%> update { control:Password-With-Header += 'userPassword' control: += 'radiusControlAttribute' request: += 'radiusRequestAttribute' reply: += 'radiusReplyAttribute' } <%- end -%> } # Set to yes if you have eDirectory and want to use the universal Loading