Skip to content

(MODULES-11808) Fix InfluxDB apt source on Ubuntu 24.04 (apt::keyring)#128

Open
actowery wants to merge 3 commits into
mainfrom
MODULES-11808/main/ubuntu-24-04-apt-keyring
Open

(MODULES-11808) Fix InfluxDB apt source on Ubuntu 24.04 (apt::keyring)#128
actowery wants to merge 3 commits into
mainfrom
MODULES-11808/main/ubuntu-24-04-apt-keyring

Conversation

@actowery
Copy link
Copy Markdown

@actowery actowery commented May 21, 2026

Summary

puppetlabs/influxdb v3.0.1 fails to install on Ubuntu 24.04 because manifests/init.pp declares the Debian apt source with an inline key => { id, source } hash. That form routes through the deprecated apt::key defined type, which drops the trust file under /etc/apt/trusted.gpg.d/ without setting signed-by= on the source list entry. Ubuntu 24.04's apt enforces deb822-style trust scoping and rejects the InfluxDB source with a missing-signature error.

This PR switches to the modern key => { 'name', 'source' } hash, which routes through apt::keyring in puppetlabs-apt 9.2.0+. The apt module then writes the key file to /etc/apt/keyrings/, references it via signed-by= on the source list entry, and orders the keyring before the source list file automatically.

Changes

  • manifests/init.pp — Debian-family branch of apt::source now uses key => { 'name' => "${repo_name}.asc", 'source' => $repo_gpg_key_url }. Param $repo_gpg_key_id is retained for backward compatibility but its docstring now notes it no longer enforces fingerprint verification (the apt::keyring path trusts the HTTPS-served file directly).
  • metadata.json — bumps puppetlabs/apt dependency floor from >= 8.0.0 to >= 9.2.0 (the release that introduced apt::keyring, 2023-12-04).
  • .fixtures.yml — pins the apt fixture to 9.2.0 so unit tests exercise the dependency floor.
  • spec/classes/init_spec.rb — asserts contain_apt__keyring('influxdb2.asc') and the structural key: hash on every Debian-family OS in operatingsystem_support (including the originally-broken Ubuntu 24.04). Adds negative assertions in the archive_source and "neither repo nor archive" contexts to guard against regressions that would leak repo resources into the no-repo code paths.

Jira

Upstream issue

Test plan

  • Unit: bundle exec rspec spec/classes/init_spec.rb — 83 examples, 0 failures across Ubuntu 18.04 / 20.04 / 22.04 / 24.04 + Debian 11.
  • Validate: bundle exec rake validate clean.
  • Lint: bundle exec rake lint clean.
  • Litmus acceptance on Ubuntu 24.04 with PE 2023.8.9 — green at commit 93b0c34 (job run, 17m41s). Acceptance spec applies include influxdb idempotently and asserts ss -Htln sport = :8086 | LISTEN, i.e. install + idempotent + service alive on a real Ubuntu 24.04 + PE 2023.8.9 VM.

Out of scope

  • Migrating Ubuntu 22.04 to deb822 sources (not required for this fix — one-line .list format with signed-by= works on 22.04).
  • Issue Upgrading toml-rb causes issues at PE customer #127 (toml-rb native extension) — separate ticket, different module (puppet_operational_dashboards).
  • Forge release — handled by auto_release.yml after merge.

🤖 Generated with Claude Code

The Debian-family branch of manifests/init.pp declared apt::source with an
inline `key => { id, source }` hash. That form routes through the deprecated
apt::key defined type, which drops the trust file under /etc/apt/trusted.gpg.d/
and does not set signed-by= on the source list entry. Ubuntu 24.04's apt
enforces deb822-style trust scoping and rejects the InfluxDB source with a
missing-signature error, so the influxdb2 package fails to install.

Switch to the name+source key hash, which routes through apt::keyring in
puppetlabs-apt 9.2.0+. apt::source then writes the key to /etc/apt/keyrings/,
references it via signed-by=, and orders the keyring before the source list
file automatically.

Also:

- Bump puppetlabs-apt dep floor to >= 9.2.0 (first version shipping
  apt::keyring) and pin the same in .fixtures.yml so unit tests exercise the
  floor.
- Mark the repo_gpg_key_id parameter as retained-for-backcompat-but-not-enforced
  in the param docstring; the fingerprint pinning previously performed by
  apt::key no longer occurs, since apt::keyring trusts the HTTPS-served file
  directly.
- Add unit assertions covering the new apt::keyring + key-hash form on every
  Debian-family OS in operatingsystem_support (including the originally
  broken Ubuntu 24.04), plus negative assertions in the archive_source and
  "neither repo nor archive" contexts to guard against future regressions
  leaking repo resources into the no-repo paths.

Reported in #126.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@actowery actowery requested review from a team and bastelfreak as code owners May 21, 2026 18:29
…for idempotency

The initial Ubuntu 24.04 fix used apt::source's key => { name, source } hash,
which internally declares apt::keyring with source => <https url>. That is
not idempotent: Puppet's HTTPS file source rewrites the local file on every
agent run because Puppet does not stably checksum HTTPS-served content. The
PE LTS litmus run on PR #128 caught this — the install puppet apply
succeeded, but the idempotency check showed the keyring file mtime changing
between runs:

  Notice: .../Apt::Keyring[influxdb2.asc]/File[.../influxdb2.asc]/content:
  content changed '{mtime}18:50:05' to '{mtime}18:50:52'

Switch to fetching the key via the archive defined type (puppet/archive is
already a module dependency), which only downloads when the destination file
is missing. Point apt::source's keyring parameter at the resulting absolute
path so the rendered source list still carries signed-by=.

Drop the apt dep floor from >= 9.2.0 back to >= 9.0.0 — apt::source's keyring
parameter has existed since v9.0.0; only the apt::keyring defined type
required 9.2.0, and this PR no longer uses it.

Declare /etc/apt/keyrings/ via ensure_resource so the archive download
succeeds on systems where the directory does not pre-exist (older Ubuntu /
Debian releases).

Test changes: assert the new archive resource and the keyring directory in
the Debian repo context; update the negative assertions in the archive_source
and "neither repo nor archive" contexts to negate the new archive resource
rather than the now-unused apt::keyring.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@actowery
Copy link
Copy Markdown
Author

CI failure context

Four jobs are red on the latest run. None are caused by this PR; all are pre-existing CI breakage on platforms this PR does not touch.

Sles-15, PE LTS and PE latest

PE install fails because pe-host-action-collector (and other PE packages) declare a net-tools dependency the configured zypper repos don't satisfy:

Error: nothing provides 'net-tools' needed by the to be installed
pe-host-action-collector-2023.8.9.1-1.sles15.noarch

The acceptance tests never run — deploy_pe::provision_master exits before them. This is a SLES image / repo-configuration gap in the test infrastructure, not a module problem.

RedHat-8, PE LTS and PE latest

Bolt's net-ssh transport drops mid-stream during the post-install deploy_pe::run_agent task — same line number both times:

.../net-ssh-7.3.2/lib/net/ssh/buffered_io.rb:101:in `send': closed stream (IOError)
"file":"spec/fixtures/modules/deploy_pe/plans/provision_master.pp","line":125

Classic SSH flake during a long-running heavy operation. Also fails before the acceptance step. Separately worth noting: RedHat-8 runs the 'RedHat': branch of case $facts['os']['family'] in manifests/init.pp (the yumrepo path), which this PR does not modify.

Prior history

The same two-platform failure pattern is present on every recent change to this module:

Run Date Title Sles-15 (LTS / latest) RedHat-8 (LTS / latest)
21864582127 2026-02-10 Update InfluxData's signing key fingerprint ❌ / ❌ ❌ / ❌
21712530103 2026-02-05 (maint) v3.0.1 Release prep ❌ / ❌ ❌ / ❌
21633134484 2026-02-03 (SUP-6938) update gpg key ❌ / ❌ ❌ / ❌
19927713177 2025-12-04 (SUP-6705): v3.0.0 Release Prep ❌ / ❌ ❌ / ❌

GitHub purged the job logs (>30 days, HTTP 410), so I can't byte-compare the failure causes against today's. What is verifiable: same workflow, same platforms, same failure conclusion across every recent merge — including the v3.0.0 and v3.0.1 release-prep PRs that did ship to Forge through this same red state.

What is green

On the latest run for this PR:

  • PE LTS Testing / Ubuntu-2404, 2023.8.9 — the ticket's stated binary pass/fail (17m41s)
  • PE LTS Testing / Ubuntu-2204, 2023.8.9 — was failing in run Add puppet-strings documentation #1 from the same idempotency bug 93b0c34 fixes
  • PE LTS Testing / Ubuntu-2404, 2025.10.0 and Ubuntu-2204, 2025.10.0
  • ✅ AlmaLinux-8/9, Rocky-Linux-8/9, RedHat-9 — both PE versions
  • ✅ Spec testing (rspec-puppet, all OSes)

The Debian-family code path this PR changes is exercised, idempotent, and green everywhere the harness can actually install PE.

@actowery actowery linked an issue May 21, 2026 that may be closed by this pull request
…File['keyrings']

Per maintainer feedback: drop the apt version pin in .fixtures.yml so CI
exercises the latest puppetlabs-apt customers are likely running, not just
the dependency floor. Bleeding-edge fixtures catch regressions in the
latest apt that would otherwise only surface to users.

Unpinning exposed a latent bug: apt 11.3.0+ declares
file { 'keyrings': path => '/etc/apt/keyrings', ... } in its main apt
class. The previous code added ensure_resource('file', '/etc/apt/keyrings',
...), creating a second File resource managing the same path with a
different title — at apply time on apt 11.3+ this would have produced
conflicting state.

Switch ensure_resource to title 'keyrings' (matching apt's declaration).
On apt < 11.3 our declaration creates the directory; on apt >= 11.3
ensure_resource is a no-op since the resource already exists. Update the
File['keyrings'] require chain on the archive resource and the matching
spec assertion to use the new title.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Missing apt::keyring on Debian based systems

1 participant