diff --git a/spec/classes/rundeck_spec.rb b/spec/classes/rundeck_spec.rb index 4ac887ef9..8a2fa5d40 100644 --- a/spec/classes/rundeck_spec.rb +++ b/spec/classes/rundeck_spec.rb @@ -39,4 +39,31 @@ it { expect { should contain_package('rundeck') }.to raise_error(Puppet::Error, /Nexenta not supported/) } end end + + context 'non-platform-specific config parameters' do + let(:facts) {{ + :osfamily => 'RedHat', + :serialnumber => 0, + :rundeck_version => '' + }} + + describe 'setting auth_config ldap url' do + let(:params) {{ + :auth_types => ['ldap'], + :auth_config => { + 'ldap' => { + 'url' => 'ldaps://myrealldap.example.com', + 'server' => 'fakeldap', + 'port' => '983', + } + } + }} + it { should contain_file('/etc/rundeck/jaas-auth.conf') } + it 'should generate valid content for jaas-auth.conf' do + content = catalogue.resource('file', '/etc/rundeck/jaas-auth.conf')[:content] + content.should include('providerUrl="ldaps://myrealldap.example.com"') + content.should_not include('providerUrl="ldap://fakeldap:983"') + end + end + end end diff --git a/templates/_auth_ldap.erb b/templates/_auth_ldap.erb index baae8dc57..a8ff99e17 100644 --- a/templates/_auth_ldap.erb +++ b/templates/_auth_ldap.erb @@ -1,7 +1,16 @@ com.dtolabs.rundeck.jetty.jaas.JettyCachingLdapLoginModule <%= @ldap_auth_flag %> debug="true" contextFactory="com.sun.jndi.ldap.LdapCtxFactory" - providerUrl="ldap://<%= @auth_config['ldap']['server'] %>:<%= @auth_config['ldap']['port'] %>" +<%- +provider_url = if @auth_config['ldap']['url'] + @auth_config['ldap']['url'] + else + server = @auth_config['ldap']['server'] + port = @auth_config['ldap']['port'] + "ldap://#{server}:#{port}" + end +-%> + providerUrl="<%= provider_url %>" authenticationMethod="simple" forceBindingLogin="<%= @auth_config['ldap']['force_binding'] %>" <%- if @auth_config['ldap']['bind_dn'] != :undef -%>