diff --git a/Gemfile b/Gemfile index 5ccf6c6..4cab0cc 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ group :test do gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false gem 'rspec-puppet-facts', '>= 1.9.5', :require => false gem 'rspec-puppet-utils', :require => false - gem 'pdk', :require => false + gem 'pdk', '>= 1.14.0', :require => false gem 'puppet-module', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false diff --git a/lib/puppet_x/ldapquery.rb b/lib/puppet_x/ldapquery.rb index c919baf..6cbe3b9 100644 --- a/lib/puppet_x/ldapquery.rb +++ b/lib/puppet_x/ldapquery.rb @@ -52,8 +52,6 @@ module PuppetX tls = Puppet[:ldaptls] ca_file = "#{Puppet[:confdir]}/ldap_ca.pem" - # TODO: if not exists ldap_ca.pem fail - conf = { host: host, port: port @@ -69,9 +67,14 @@ module PuppetX if tls conf[:encryption] = { - method: :simple_tls, - tls_options: { ca_file: ca_file } + method: :simple_tls } + if File.file?(ca_file) + Puppet.debug("Using #{ca_file} as CA for TLS connection") + conf[:encryption][:tls_options] = { ca_file: ca_file } + else + Puppet.debug("#{ca_file} not found, using default CAs installed in your system") + end end conf