Repository navigation
(MODULES-11990) Fix SLES 12 mod_security apache start failures in acceptance - #2659
Merged
Merged
Conversation
…tance On SLES 12 the mod_security acceptance tests intermittently fail with "Systemd start for apache2 failed!", and the log never shows why: Puppet's systemd provider attaches `journalctl -n 50 --since '5 minutes ago'`, which on SLES 12's systemd prints the oldest 50 lines of the window, and errors raised after the config is parsed only reach the apache error log. Replace the retry wrapper with one that re-raises the failure with the hostname/resolver state, systemctl status, the apache journal and error log, and the listening sockets appended. Co-Authored-By: Claude <noreply@anthropic.com>
SLES 12 gets httpd 2.4.23 from the Leap 42.3 repo. Its mod_unique_id, loaded by apache::mod::security, refuses to start apache when the node's own hostname doesn't resolve to an IPv4 address (AH01564, followed by AH00016 Configuration Failed); httpd 2.4.29 dropped that check. On the provisioned SLES 12 VM, /etc/hosts has no entry for the node and the CI workflow strips the `search` line from /etc/resolv.conf, so the short hostname is resolved by a bare DNS query that succeeds or fails from one moment to the next. The diagnostics run confirmed this: every failed start logged "(EAI 2)Name or service not known: AH01564", and the same lookup flipped from success to failure within ~20s on passing runs. Add an /etc/hosts entry for the node, named after the FQDN with the short hostname as an alias, so the lookup no longer depends on DNS and the fqdn fact (and with it the default ServerName) stays stable. With the entry in place, 20 of 20 SLES 12 acceptance jobs (puppetcore8 and puppetcore9 nightly) passed, against 3 of 10 without it. Co-Authored-By: Claude <noreply@anthropic.com>
imaqsood
requested review from
a team,
bastelfreak,
ekohl and
smortex
as code owners
October 21, 2026 15:17
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped test-only changes have no identified blocking issues and are supported by the reported successful SLES 12 acceptance experiments.
No open issues 🎉
What changed in this PR
This PR addresses intermittent SLES 12 mod_security acceptance failures caused by unreliable hostname resolution. Changes are limited to test setup and failure diagnostics; module behavior is unchanged.
Changes:
- Add an FQDN-based
/etc/hostsentry on SLES versions below 15, with the short hostname as an alias. - Replace restart retries with hostname, network, and Apache diagnostics appended to start or restart failures.
| File | Description |
|---|---|
spec/setup_acceptance_node.pp |
Stabilizes local hostname resolution and the canonical FQDN on older SLES nodes. |
spec/acceptance/mod_security_spec.rb |
Removes retries and preserves failures with additional diagnostic output. |
Review effort: Balanced
SugatD
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the intermittent SLES 12 acceptance failure
Systemd start for apache2 failed!inspec/acceptance/mod_security_spec.rb. Both changes are test-only; module code is unchanged.spec/setup_acceptance_node.pp: on SLES < 15, add an/etc/hostsentry for the node. The entry is named after the FQDN, with the short hostname as an alias, so the node's own hostname resolves without DNS.spec/acceptance/mod_security_spec.rb: remove the retry wrapper (it only matchedrestart, and retrying didn't help). If apache fails to start, the error is now re-raised with diagnostics appended: hostname andgetent,/etc/hosts,resolv.conf,systemctl status, the apache journal, the tail oferror.log, and listening sockets.Additional Context
Root cause and the steps to reproduce.
SLES 12 gets httpd 2.4.23 from the Leap 42.3 repo that
setup_acceptance_node.ppadds. In that version,mod_unique_id(loaded byapache::mod::security) resolves the server's own hostname over IPv4 during post_config. If the lookup fails, it returns an error and apache won't start. httpd 2.4.29 removed that check.On the provisioned SLES 12 VM,
/etc/hostshas no entry for the node, and cat-github-actionsmodule_acceptance.ymlstrips thesearchline from/etc/resolv.confon all targets. That leaves onlynameserver 169.254.169.254, so the short hostname is resolved by a bare DNS query, which succeeds or fails from one moment to the next.The failure never showed in CI logs. Puppet's systemd provider attaches
journalctl -n 50 --since '5 minutes ago', which on SLES 12 prints the oldest 50 lines of that window, and this error is written only to apache'serror.log.Thought process behind the implementation. The fix was confirmed with two SLES-12-only experiment runs (puppetcore8 + puppetcore9 nightly, full suite):
Every failure in A logged
[unique_id:alert] (EAI 2)Name or service not known: AH01564: unable to find IPv4 address of "litmus-<id>"followed byAH00016: Configuration Failed. In all three passing A jobs,getent ahostsv4 $(hostname)succeeded before the mod_security tests and failed about 20 s later, so those jobs passed only because apache happened to start while the lookup was working. In B, the lookup succeeded in all 40 probes.Making the FQDN the canonical name keeps the
fqdnfact, and with it the defaultServerName, stable. Earlier SLES 12 logs show it flipping to the bare hostname mid-run, which caused idempotency failures such asmod_dav_svn_spec.rb:18.Experiment runs: A = 39605092342, 39605145388, 39605198578, 39605251239, 39605304500; B = 39616320212, 39616369394, 39616418221, 39616467904, 39616517143, 39619664972, 39619719393, 39619774766, 39619833907, 39619886378.
Related Issues (if any)
MODULES-11990 (epic MODULES-11964, restore supported-modules nightly health).
Checklist
spec/classes/mod/security_spec.rb282 examples, 0 failures; rubocop clean; puppet-lint warnings unchanged from main.setup_acceptance_node.pp(Host present on SLES 12, absent on SLES 15).puppet applyof the host resource writesIP fqdn short.🤖 Generated with Claude Code