Skip to content

Fix Debian arch detection, Hiera scope errors, and test reliability#228

Merged
bernd merged 1 commit into
mainfrom
improve/pr-224
Mar 14, 2026
Merged

Fix Debian arch detection, Hiera scope errors, and test reliability#228
bernd merged 1 commit into
mainfrom
improve/pr-224

Conversation

@bernd

@bernd bernd commented Mar 14, 2026

Copy link
Copy Markdown
Owner

Use dpkg --print-architecture on Debian to return Facter-compatible arch values (amd64, arm64) instead of RbConfig's x86_64/aarch64, since recipes use Facts.arch in download URLs expecting Debian-style names.

Hiera::Scope#[] now raises ScopeError for unknown keys instead of returning nil, making the Facter removal a loud failure for direct callers. Normal Hiera flow is unaffected since include? gates access.

Fix DependencyInspector#update_package_db_once to only set the updated flag after a successful refresh, so failed apt-get update/yum makecache commands are retried.

Fix test pollution in recipe_spec.rb where class_eval redefined Facts.arch and Facts.target permanently, leaking across tests. Replace with scoped RSpec stubs.

Additional changes:

  • Add DependencyInspector.reset! for cleaner test setup
  • Extract find_command helper to resolve full paths (eliminates TOCTOU)
  • Warn on unmapped platforms in detect_osfamily
  • Fix bundler version selection for Ruby < 3.2 in distro tests

Use dpkg --print-architecture on Debian to return Facter-compatible arch
values (amd64, arm64) instead of RbConfig's x86_64/aarch64, since recipes
use Facts.arch in download URLs expecting Debian-style names.

Hiera::Scope#[] now raises ScopeError for unknown keys instead of
returning nil, making the Facter removal a loud failure for direct
callers. Normal Hiera flow is unaffected since include? gates access.

Fix DependencyInspector#update_package_db_once to only set the updated
flag after a successful refresh, so failed apt-get update/yum makecache
commands are retried.

Fix test pollution in recipe_spec.rb where class_eval redefined
Facts.arch and Facts.target permanently, leaking across tests. Replace
with scoped RSpec stubs.

Additional changes:
- Add DependencyInspector.reset! for cleaner test setup
- Extract find_command helper to resolve full paths (eliminates TOCTOU)
- Warn on unmapped platforms in detect_osfamily
- Fix bundler version selection for Ruby < 3.2 in distro tests
@bernd
bernd merged commit 758a236 into main Mar 14, 2026
6 checks passed
@bernd
bernd deleted the improve/pr-224 branch March 14, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant