Skip to content

Commit

Permalink
Preserve /etc/httpd/conf.d/passenger.conf on EL7
Browse files Browse the repository at this point in the history
mod_passenger provides a passenger.conf containing PassengerRoot to
ensure the service starts up correctly.  On EL7, this is installed at
/etc/httpd/conf.d/passenger.conf and has been protected from purging
since 005bf61.

The change in 2a60859 to move LoadModule config files to
/etc/httpd/conf.modules.d/ on EL7 also affected the path of the
protected passenger.conf.  This change reverts the path change to match
the packages.

In summary, prior to 2a60859 (release 1.7.0):

- /etc/httpd/conf.d/passenger.conf with PassengerRoot (packaged)
- /etc/httpd/conf.d/passenger_extra.conf with apache::mod::passenger settings
- /etc/httpd/conf.d/zpassenger.load with LoadModule

In 2a60859 (release 1.8.0):

- /etc/httpd/conf.modules.d/passenger_extra.conf with apache::mod::passenger settings
- /etc/httpd/conf.modules.d/zpassenger.load with LoadModule
- /etc/httpd/conf.d/passenger.conf is purged

With this commit:

- /etc/httpd/conf.modules.d/passenger_extra.conf with apache::mod::passenger settings
- /etc/httpd/conf.modules.d/zpassenger.load with LoadModule
- /etc/httpd/conf.d/passenger.conf with PassengerRoot (packaged)
  • Loading branch information
Dominic Cleal committed Jan 28, 2016
1 parent ce48f57 commit ecc2909
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 25 deletions.
2 changes: 1 addition & 1 deletion manifests/mod/passenger.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# Managed by the package, but declare it to avoid purging
if $passenger_conf_package_file {
file { 'passenger_package.conf':
path => "${::apache::mod_dir}/${passenger_conf_package_file}",
path => "${::apache::confd_dir}/${passenger_conf_package_file}",
}
}

Expand Down
63 changes: 39 additions & 24 deletions spec/classes/mod/passenger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,9 @@
end

context "on a RedHat OS" do
let :facts do
let :rh_facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:operatingsystem => 'RedHat',
:id => 'root',
Expand All @@ -249,30 +248,46 @@
:is_pe => false,
}
end
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('passenger') }
it { is_expected.to contain_package("mod_passenger") }
it { is_expected.to contain_file('passenger_package.conf').with({
'path' => '/etc/httpd/conf.d/passenger.conf',
}) }
it { is_expected.to contain_file('passenger_package.conf').without_content }
it { is_expected.to contain_file('passenger_package.conf').without_source }
it { is_expected.to contain_file('zpassenger.load').with({
'path' => '/etc/httpd/conf.d/zpassenger.load',
}) }
it { is_expected.to contain_file('passenger.conf').without_content(/PassengerRoot/) }
it { is_expected.to contain_file('passenger.conf').without_content(/PassengerRuby/) }
describe "with passenger_root => '/usr/lib/example'" do
let :params do
{ :passenger_root => '/usr/lib/example' }

context "on EL6" do
let(:facts) { rh_facts.merge(:operatingsystemrelease => '6') }

it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('passenger') }
it { is_expected.to contain_package("mod_passenger") }
it { is_expected.to contain_file('passenger_package.conf').with({
'path' => '/etc/httpd/conf.d/passenger.conf',
}) }
it { is_expected.to contain_file('passenger_package.conf').without_content }
it { is_expected.to contain_file('passenger_package.conf').without_source }
it { is_expected.to contain_file('zpassenger.load').with({
'path' => '/etc/httpd/conf.d/zpassenger.load',
}) }
it { is_expected.to contain_file('passenger.conf').without_content(/PassengerRoot/) }
it { is_expected.to contain_file('passenger.conf').without_content(/PassengerRuby/) }
describe "with passenger_root => '/usr/lib/example'" do
let :params do
{ :passenger_root => '/usr/lib/example' }
end
it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/example"$/) }
end
it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/example"$/) }
end
describe "with passenger_ruby => /usr/lib/example/ruby" do
let :params do
{ :passenger_ruby => '/usr/lib/example/ruby' }
describe "with passenger_ruby => /usr/lib/example/ruby" do
let :params do
{ :passenger_ruby => '/usr/lib/example/ruby' }
end
it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/lib\/example\/ruby"$/) }
end
it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/lib\/example\/ruby"$/) }
end

context "on EL7" do
let(:facts) { rh_facts.merge(:operatingsystemrelease => '7') }

it { is_expected.to contain_file('passenger_package.conf').with({
'path' => '/etc/httpd/conf.d/passenger.conf',
}) }
it { is_expected.to contain_file('zpassenger.load').with({
'path' => '/etc/httpd/conf.modules.d/zpassenger.load',
}) }
end
end
context "on a FreeBSD OS" do
Expand Down

3 comments on commit ecc2909

@traylenator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just got caught out with this one, not sure why passenger is special, why does it's configuration file
from the package get preserved. That is not the case with other module is it?

Steve

@domcleal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@traylenator because the PassengerRoot directive is normally in this config file, and the value varies so much between packages and operating systems I figured in 005bf61 that it was worth preserving the packaged value.

It would be a lot of effort to keep the value in this module accurate, and more work for the user to have to specify the value (though I think that's perhaps the more correct approach).

@af6140
Copy link

@af6140 af6140 commented on ecc2909 Apr 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the default loading sequence of the conf files

Include "/etc/httpd/conf.modules.d/.load"
Include "/etc/httpd/conf.modules.d/
.conf"
Include "/etc/httpd/conf/ports.conf"

IncludeOptional "/etc/httpd/conf.d/*.conf"

According to this, the conf.d/passenger.conf from el7 package will overwrite any apache::mod::passenger settings like passengerruby

Please sign in to comment.