-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable::mpm_event: Fix module deactivation #2349
Conversation
apache::mpm::disable_mpm_event is a classthat may have no external impact to Forge modules. This module is declared in 176 of 580 indexed public
|
7f5230f
to
1305f23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering about differences in disable steps. We already have 2 identical disable steps: worker and prefork:
$ diff -Nut <(sed 's/worker/prefork/g' disable_mpm_worker.pp) disable_mpm_prefork.pp
$
With this change there is a third:
$ diff -Nut <(sed 's/worker/event/g' disable_mpm_worker.pp) disable_mpm_event.pp
--- /dev/fd/63 2022-12-06 11:53:19.373572653 +0100
+++ disable_mpm_event.pp 2022-12-06 11:53:00.571376870 +0100
@@ -1,11 +1,11 @@
# @summary disable Apache-Module event
class apache::mpm::disable_mpm_event {
- $event_command = ['/usr/sbin/a2dismod', 'event']
- $event_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'event.load'],'/')]]
- exec { '/usr/sbin/a2dismod event':
+ $event_command = ['/usr/sbin/a2dismod', 'mpm_event']
+ $event_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'mpm_event.load'],'/')]]
+ exec { '/usr/sbin/a2dismod mpm_event':
command => $event_command,
onlyif => $event_onlyif,
require => Package['httpd'],
- before => Class['apache::service'],
+ notify => Class['apache::service'],
}
}
There are 2 changes: first is that my replacement isn't quite correct, but really it would be if you introduced $mpm_name
. The second is before
vs notify
. Looking at this file it was before
, but notify
looks more correct to me.
They're also (IMHO) private classes that are only used once:
puppetlabs-apache/manifests/mpm.pp
Lines 97 to 108 in 1d2302d
unless $mpm in ['itk', 'prefork'] { | |
include apache::mpm::disable_mpm_prefork | |
} | |
if $mpm != 'worker' { | |
include apache::mpm::disable_mpm_worker | |
} | |
if $mpm != 'event' { | |
include apache::mpm::disable_mpm_event | |
} | |
} |
Perhaps we should introduce a define
and call it with the right module name?
1305f23
to
eca8549
Compare
I also noticed this and will try to clean it up. I updated the commit description with some history of this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an a2mod type. I wonder that should be used. However, in the short term I'll take this cleanup.
there were a few things broken: * a2dismod was called with the wrong module name. at least on apache 2.4.54 on Debian 11 it is named mpm_event, not event * the paths to the files were wrong * a2dismod already purges the .load and .conf file, the exec resources are not required (even then a file resource would probably be cleaner to purge them) * Apache needs to be reloaded, so just running this priot to apache2::service isn't enough, it needs to be a notify This initially worked but was changed from mpm_event to event in puppetlabs#1961. Then it was fixed in puppetlabs#2034 by adding the exec resources, but the actual a2dismod was still broken.
eca8549
to
1797602
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
there were a few things broken:
are not required (even then a file resource would probably be cleaner
to purge them)
apache2::service isn't enough, it needs to be a notify
This initially worked but was changed from mpm_event to event in #1961. Then it was fixed in #2034 by adding the exec resources, but the actual a2dismod was still broken.