Skip to content

Fixes #39912 - Declare the syslog logging dependency - #11337

Open
jakduch wants to merge 1 commit into
theforeman:developfrom
jakduch:fix/39912-explicit-syslog
Open

jakduch wants to merge 1 commit into
theforeman:developfrom
jakduch:fix/39912-explicit-syslog

Conversation

@jakduch

@jakduch jakduch commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Declare syslog as a direct dependency on Ruby 3.4 and later, and load it explicitly before Foreman's logging library on every supported Ruby version. Earlier Ruby versions keep using their standard-library copy. Add a subprocess regression test that loads foreman/logging without Rails initialization and checks that the required syslog facility constant is available.

Why

Ruby 3.4 moved syslog from a default gem to a bundled gem, which must be declared when used with Bundler (Ruby release notes). Foreman uses Syslog::Constants when constructing its root logger but previously relied on the standard-library/transitive dependency being available.

With Ruby 4.0.7 the application currently fails with NameError: uninitialized constant Syslog. This also affects file/stdout logging because the facility constant is resolved before selecting an appender. The change keeps existing logging behavior rather than silently disabling a backend.

Reproduction: https://github.com/jakduch/foreman/actions/runs/38784634977/job/116593360504

Testing

  • Runtime verification on Ruby 3.0 / Ubuntu 24.04 and Ruby 3.3 / Ubuntu 26.04 completed successfully, including Rubocop, application boot, database migrations, schema restoration and the logging regression test invocation.
  • Follow-up verification includes the independent observer fix (Fixes #39913 - Declare observer for test factories #11338). The logging suite passed on Ruby 3.0 and 3.3: 12 tests, 22 assertions, no failures/errors/skips on each. On Ruby 4.0.7 / Ubuntu 26.04, Rubocop, boot, migrations, schema restoration, the targeted logging suite and standalone factory_bot loading all passed; the full unit suite is being investigated separately.

Earlier diagnostic revision: dc8bf64.

The diagnostic jobs additionally include the independent PostgreSQL CI client fix (#39911), and the Ruby 4 job uses the proposed ldap_fluff and safemode changes to get through dependency resolution. Those overrides are confined to the fork's investigation workflow and are not part of this PR. This fixes one concrete startup blocker, not the complete Ruby 4 migration or package qualification.

Issue: https://projects.theforeman.org/issues/39912
Related tracking: https://projects.theforeman.org/issues/39910

EL9 build compatibility follow-up

The previous EL9 RPM build used Ruby 3.0. The unconditional Gemfile entry generated a rubygem(syslog) build requirement, whose available providers belonged to inactive Ruby streams. The dependency is now conditional on Ruby 3.4 and later; the explicit require and subprocess logging regression remain. The single commit is rebased onto current develop.

Locally, Bundler evaluated the actual Gemfile under eight simulated Ruby version values: 3.0.7, 3.1.7, 3.2.0, 3.3.12, 3.4.0, 3.5.0, 3.10.0 and 4.0.7. The syslog gem dependency was absent before 3.4 and present from 3.4 onward. This checks dependency declaration, not execution on eight Ruby runtimes. Three Ruby syntax checks and git diff --check also passed. Full application and RPM validation is left to the fresh CI run.

AI assistance: Codex. Project signature: GPT_5.6 Sol.

@lzap

lzap commented Oct 16, 2026

Copy link
Copy Markdown
Member

@theforeman/packaging

@jakduch

jakduch commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

The remaining EL9 RPM failure occurs during dependency resolution: DNF rejects ruby-default-gems and ruby-bundled-gems providers due to modular filtering, before building Foreman. EL10 RPM CI passed. The EL9 package/module selection still needs investigation; I have not removed the explicit syslog dependency to hide that failure.

Declare syslog for Ruby 3.4 and later, while older versions retain their
standard-library copy without generating unavailable EL9 RPM requirements.
Load it explicitly before the logging gem and cover standalone loading.

AI assistance: Codex. Project signature: GPT_5.6 Sol.
@jakduch
jakduch force-pushed the fix/39912-explicit-syslog branch from dc8bf64 to 7de3308 Compare October 28, 2026 08:29
@jakduch

jakduch commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the EL9 RPM dependency failure in 7de3308 and rebased onto current develop. The syslog gem is now declared only for Ruby 3.4 and later; earlier Ruby versions keep their standard-library copy, avoiding providers from inactive Ruby streams. The explicit require and standalone logging regression remain. Bundler evaluation of the actual Gemfile passed for eight simulated version values, along with syntax/diff checks. This was dependency-declaration validation, not eight runtime tests. The PR still contains one commit; fresh application and RPM CI is pending.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants