Skip to content

Commit

Permalink
Add shared gem path for Puppetserver >= 5.3
Browse files Browse the repository at this point in the history
Since 5.3.0 Puppet Server can use some gems shipped by puppet-agent. For
this the gem-path settings of puppetserver.conf needs to be extend by
/opt/puppetlabs/puppet/lib/ruby/vendor_gems. This is the default as
shipped by Puppetlabs.

Fixes theforemanGH-630.
  • Loading branch information
baurmatt committed Sep 19, 2018
1 parent 73f7fe6 commit 8bda424
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/classes/puppet_server_puppetserver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,34 @@
end
end

describe 'gem-path' do
context 'when server_puppetserver_version > 2.7 but < 5.3' do
let(:params) do
default_params.merge(
:server_puppetserver_version => '5.0.0',
)
end

it 'should have gem-path: [${jruby-puppet.gem-home}, "/opt/puppetlabs/server/data/puppetserver/vendored-jruby-gems"] in config' do
content = catalogue.resource('file', '/etc/custom/puppetserver/conf.d/puppetserver.conf').send(:parameters)[:content]
expect(content).to include(%Q[ gem-path: [${jruby-puppet.gem-home}, "/opt/puppetlabs/server/data/puppetserver/vendored-jruby-gems"]\n])
end
end

context 'when server_puppetserver_version >= 5.3' do
let(:params) do
default_params.merge(
:server_puppetserver_version => '5.3.0',
)
end

it 'should have gem-path: [${jruby-puppet.gem-home}, "/opt/puppetlabs/server/data/puppetserver/vendored-jruby-gems", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems"] in config' do
content = catalogue.resource('file', '/etc/custom/puppetserver/conf.d/puppetserver.conf').send(:parameters)[:content]
expect(content).to include(%Q[ gem-path: [${jruby-puppet.gem-home}, "/opt/puppetlabs/server/data/puppetserver/vendored-jruby-gems", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems"]\n])
end
end
end

describe 'when server_puppetserver_version < 2.2' do
let(:params) do
default_params.merge(:server_puppetserver_version => '2.1.0')
Expand Down
4 changes: 4 additions & 0 deletions templates/server/puppetserver/conf.d/puppetserver.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jruby-puppet: {
# This setting defines the complete "GEM_PATH" for jruby. If set, it should include
# the gem-home directory as well as any other directories that gems can be loaded
# from (including the vendored gems directory for gems that ship with puppetserver)
<%- if scope.function_versioncmp([@server_puppetserver_version, '5.3']) >= 0 -%>
gem-path: [${jruby-puppet.gem-home}, "<%= @server_puppetserver_vardir %>/vendored-jruby-gems", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems"]
<% else -%>
gem-path: [${jruby-puppet.gem-home}, "<%= @server_puppetserver_vardir %>/vendored-jruby-gems"]
<%- end -%>

<%- end -%>
# PLEASE NOTE: Use caution when modifying the below settings. Modifying
Expand Down

0 comments on commit 8bda424

Please sign in to comment.