From 5b91e6733a81859aefa3fcfb0925ac6ab4bb874f Mon Sep 17 00:00:00 2001 From: Wil Cooley Date: Mon, 11 May 2015 17:00:52 -0700 Subject: [PATCH 1/2] Add context for merging potentially conflicting tests --- spec/classes/rundeck_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/classes/rundeck_spec.rb b/spec/classes/rundeck_spec.rb index 4ac887ef9..b70e05dbb 100644 --- a/spec/classes/rundeck_spec.rb +++ b/spec/classes/rundeck_spec.rb @@ -39,4 +39,14 @@ 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 => '' + }} + + + end end From ccdf7ccb869ed282efa0e046a1e85d75857d72b0 Mon Sep 17 00:00:00 2001 From: Wil Cooley Date: Mon, 11 May 2015 13:31:22 -0700 Subject: [PATCH 2/2] Allow an "url" parameter for LDAP connection Instead of building the URL for the LDAP connection, accept an "url" parameter. This allows enabling LDAP/SSL without yet-another parameter (it also allows for easier re-use of existing hiera settings). --- spec/classes/rundeck_spec.rb | 19 ++++++++++++++++++- templates/_auth_ldap.erb | 11 ++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/spec/classes/rundeck_spec.rb b/spec/classes/rundeck_spec.rb index b70e05dbb..8a2fa5d40 100644 --- a/spec/classes/rundeck_spec.rb +++ b/spec/classes/rundeck_spec.rb @@ -47,6 +47,23 @@ :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 -%>