Skip to content

(MODULES-11858) Restore Puppet 7 support broken by 10.6.2#1686

Merged
imaqsood merged 1 commit into
mainfrom
MODULES-11858-restore-puppet7
Jul 7, 2026
Merged

(MODULES-11858) Restore Puppet 7 support broken by 10.6.2#1686
imaqsood merged 1 commit into
mainfrom
MODULES-11858-restore-puppet7

Conversation

@imaqsood

@imaqsood imaqsood commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1685 (MODULES-11858). 10.6.2 was tagged a patch but PR #1646 (CAT-2385 Puppetcore update) introduced a hard syntax error that breaks existing installations on Puppet 7.

.rubocop.yml bumped TargetRubyVersion to 3.1, so rubocop -A rewrote hash literals to Ruby 3.1 shorthand (salt: instead of salt: salt) in three custom functions/providers. That shorthand is a syntax error on Ruby 2.7 — the Ruby that Puppet 7 ships — so any Puppet 7 catalog using postgresql::postgresql_password, postgresql_conf, or postgresql_replication_slot fails to compile with syntax error, unexpected ',' (#1685).

What this PR does

Reverts only the Ruby-side breakage:

File(s) Change
postgresql_password.rb, postgresql_conf/ruby.rb, postgresql_replication_slot/ruby.rb Revert Ruby 3.1 shorthand hash → explicit form (keeps the unrelated postgresql_conf entry_regex bugfix from #1657)
.rubocop.yml TargetRubyVersion back to '2.6' so autocorrect can't reintroduce the shorthand
4 spec files Revert the same shorthand autocorrection so they parse under the 2.6 target

The puppet requirement in metadata.json is left at >= 8.0.0 per review — this PR is scoped to the Ruby syntax fix only. The puppetcore8 Gemfile/CI changes from #1646 also stay in place (dev/test only, not consumer-facing).

Testing

  • pdk validate → clean (exit 0)
  • Full unit suite → 685 examples, 0 failures
  • Litmus end-to-end on Rocky 9, both agents:
    • Puppet 7.34 / Ruby 2.7.8 — reproduced Invalid ruby syntax in 10.6.2 #1685 with the old code, then confirmed fixed: postgresql::server install → idempotent second run, testdb created, and a SCRAM-SHA-256 password hash written to the live database (the exact digest_key path that was crashing).
    • Puppet 8.10 / Ruby 3.2.5 — same install + idempotency + SCRAM checks pass (no forward regression).

🤖 Generated with Claude Code

Comment thread metadata.json Outdated
10.6.2 (PR #1646, "CAT-2385 Puppetcore update") bumped .rubocop.yml
TargetRubyVersion to 3.1, so `rubocop -A` rewrote hash literals to Ruby
3.1 shorthand (`salt:` instead of `salt: salt`) in three custom
functions/providers. That shorthand is a hard syntax error on Ruby <
3.1, and Puppet 7 ships Ruby 2.7 -- so any Puppet 7 catalog using
postgresql::postgresql_password, postgresql_conf or
postgresql_replication_slot failed to compile with "syntax error,
unexpected ','" (issue #1685).

Fix the Ruby side so existing Puppet 7 installations keep working:

  - .rubocop.yml: TargetRubyVersion back to '2.6' so autocorrect can't
    reintroduce the shorthand.
  - Revert the Ruby 3.1 shorthand hash syntax in the three lib files
    (keeping the unrelated postgresql_conf entry_regex bugfix from
    #1657).
  - Revert the same shorthand autocorrection in four spec files so they
    parse under the 2.6 target.

Verified with `pdk validate`, the full unit suite (685 examples, 0
failures), and Litmus end-to-end applies on both Puppet 7.34/Ruby 2.7
and Puppet 8.10/Ruby 3.2 (install, idempotency, and a SCRAM-SHA-256
password hash stored in the live database).

Fixes #1685

Co-Authored-By: Claude <noreply@anthropic.com>
@imaqsood imaqsood force-pushed the MODULES-11858-restore-puppet7 branch from fb5140d to 01eab72 Compare July 7, 2026 08:37

@ekohl ekohl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Untested, but from a first glance this looks correct.

@imaqsood imaqsood merged commit 1ce0ca3 into main Jul 7, 2026
31 of 35 checks passed
@imaqsood imaqsood deleted the MODULES-11858-restore-puppet7 branch July 7, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid ruby syntax in 10.6.2

3 participants