Skip to content

(MODULES-11902) Force reinstall puppet_agent module in acceptance bootstrap - #507

Open
SugatD wants to merge 1 commit into
mainfrom
MODULES-11902-puppet-agent-force-install
Open

(MODULES-11902) Force reinstall puppet_agent module in acceptance bootstrap#507
SugatD wants to merge 1 commit into
mainfrom
MODULES-11902-puppet-agent-force-install

Conversation

@SugatD

@SugatD SugatD commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

The Windows acceptance test matrix (nightly, all OS versions) has been failing at the before(:suite) hook with:

Error: Evaluation Error: Unknown variable: '::osfamily'.
(file: .../modules/puppet_agent/manifests/params.pp, line: 7)

Root cause: the base VM image ships with a pre-baked puppetlabs-puppet_agent module (<=4.0.0) that still uses the deprecated top-scope fact syntax ($::osfamily), which Puppet 8 no longer supports (removed the top-scope-variable compatibility shim for facts). The guard added in #494 (MODULES-11615) only installs puppet_agent when no version is present, so this stale, incompatible copy was never replaced.

Fix

Force-reinstall puppetlabs-puppet_agent unconditionally in spec/spec_helper_acceptance_local.rb, so a Puppet-8-compatible release is always used regardless of what's pre-baked on the image.

Note on base branch

This is temporarily rebased on top of MODULES-11902 (PR #506) rather than main, because the Windows acceptance matrix here won't run until the Spec job passes, and Spec needs the puppetlabs/stdlib upper-bound fix from #506 to get past dependency-checker. Once #506 merges, this branch will be rebased onto main and the diff will shrink to just the spec_helper_acceptance_local.rb change.

Checklist

  • Ruby syntax check
  • rubocop clean
  • Verified against the Windows acceptance matrix (CI running)

Related: https://perforce.atlassian.net/browse/MODULES-11902

@SugatD
SugatD requested a review from a team as a code owner July 21, 2026 08:38
@SugatD
SugatD force-pushed the MODULES-11902-puppet-agent-force-install branch from b83ffd6 to 573599a Compare July 21, 2026 10:21
@SugatD
SugatD marked this pull request as draft July 21, 2026 13:07
@SugatD
SugatD marked this pull request as ready for review August 11, 2026 05:11
The Windows acceptance matrix was failing at the before(:suite) hook with
"Unknown variable: '::osfamily'" because the base VM image ships with a
pre-baked puppetlabs-puppet_agent (and other) module predating Puppet 8's
removal of top-scope fact variables. Getting the suite running again then
surfaced several further issues once each prior one was fixed:

- Loosen metadata.json's puppet/stdlib version requirements so the module
  installs against Puppet 8 and stdlib 10.x.
- Force-reinstall puppetlabs-puppet_agent, -mount_iso, -stdlib, and
  puppet/archive in the acceptance bootstrap, since the pre-baked copies on
  the image are incompatible with Puppet 8.
- Route SQL Server installs through a password-based scheduled task instead
  of a plain WinRM apply_manifest. SQL Server's setup chainer uses Windows
  DPAPI to serialize secure config values (e.g. sa_pwd), which requires a
  loaded user profile that a WinRM session doesn't have, so setup failed
  with "There was an error generating the XML document." A scheduled task
  performs a real logon and works around this. Registering the task with
  both a trigger and an explicit Start-ScheduledTask call raced the two
  start attempts and could mask a genuine install failure behind a bogus
  success (Task Scheduler's LastTaskResult 0x800710E0 "operator refused"
  overflowing Int32 on exit) - dropped the redundant trigger.
- Apply the same scheduled-task workaround in sqlserver_instance_spec.rb and
  sqlserver_config_spec.rb, which create their own instances beyond the one
  from before(:suite) and hit the identical DPAPI limitation.
- Fix a db_name/@db_name typo in sqlserver_user_spec.rb, a PowerShell
  quoting bug in validate_sql_install where $s was being stripped by the
  local shell before reaching the target, and a missing SQL 2019+ version
  gate on Integration Services/Master Data Services assertions in
  z_last_sqlserver_features_spec.rb.
@SugatD
SugatD force-pushed the MODULES-11902-puppet-agent-force-install branch from 3e9914f to 45d296e Compare August 11, 2026 05:22
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.

1 participant