Skip to content

Fix Ubuntu 24 puppet-agent installation by using version-specific collections #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

gavindidrichsen
Copy link

@gavindidrichsen gavindidrichsen commented Apr 23, 2025

Outstanding tasks

  • Verify works as expected with bolt
  • What's the behaviour if /opt/puppetlabs/puppet/VERSION already exists? See tim's comment

Issue

When running Bolt apply with Ubuntu 24 (noble), if no collection is explicitly specified, the task defaults to using the generic 'puppet' collection, resulting in installing 'puppet-release-noble.deb' instead of the version-specific 'puppet8-release-noble.deb'. This causes installation failures specific to Ubuntu 24, while other OSes work fine.

A previous fix attempted to address this in bolt's apply_prep function, but that placed OS-specific logic in the wrong architectural layer.

Solution

This PR moves the solution to the correct location by enhancing the collection selection logic in install_shell.sh to:

  1. First check if a collection was explicitly specified (unchanged)

    • If so, use that collection
    • This maintains backward compatibility and user control
  2. If no collection is specified, intelligently determine the appropriate collection:

    • First try to detect Puppet version from /opt/puppetlabs/puppet/VERSION
    • If that fails, try using the puppet --version command
    • Use the major version to set the collection to puppet{major_version} (e.g., puppet8)
    • Only fall back to the generic puppet collection as a last resort

This ensures that:

  • Ubuntu 24 installations correctly use puppet8-release-noble.deb
  • The target-specific logic is in the proper architectural layer
  • We maintain backward compatibility
  • We have better logging to track which method was used

When a collection is not explicitly specified, determine the appropriate
collection based on the installed Puppet version rather than defaulting
to the generic 'puppet' collection. This ensures platforms like Ubuntu 24
use the correct version-specific package (e.g., puppet8-release) instead
of the generic package (puppet-release) which can cause failures.

Signed-off-by: Gavin Didrichsen <[email protected]>
Signed-off-by: Gavin Didrichsen <[email protected]>
Copy link

@danadoherty639 danadoherty639 left a comment

Choose a reason for hiding this comment

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

Tested this manually and it works

@gavindidrichsen
Copy link
Author

Closing this after discussion with Josh Cooper

That was my initial attempt at fixing the ubuntu 24 issue by directly changing the puppet_agent::install. When I discussed this with Josh Cooper he did not want to merge this and explained I should be able to fix the issue by using the correct collection.

@gavindidrichsen gavindidrichsen deleted the gavin_add_ubuntu24_specific_selection branch May 28, 2025 14:57
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.

3 participants