bolt icon indicating copy to clipboard operation
bolt copied to clipboard

Applying Puppet plans fails on Debian 12 Bookworm targets

Open FredPraca opened this issue 1 year ago • 4 comments

Describe the Bug

Applying a Puppet plan against Debian Bookworm fails with the following error :

$ bolt plan run server_install::configure -t test
Starting: plan server_install::configure
Starting: install puppet and gather facts on test
Finished: plan server_install::configure in 11.06 sec
Failed on test:
  The task failed with exit code 127 and no stdout, but stderr contained:
  bash: line 1: /tmp/fc36dad6-d110-4cd6-abb3-ed7f53cf2a07/custom_facts.rb: cannot execute: required file not found
Failed on 1 target: test
Ran on 1 target

Expected Behavior

Correct behavior is to not fail and going on.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a Bolt projet
  2. Add a plan in Puppet format using apply_prep
  3. Run the plan against a target running Debian 12 Bookworm

Environment

  • Version 3.27.4
  • Platform Ubuntu 20.04LTS running Bolt, Debian 12 Bookworm as target

Additional Context

The problem was wrongly reported in the PHP project Bolt here

FredPraca avatar Dec 30 '23 23:12 FredPraca

The file custom_facts.rb uses #! /opt/puppetlabs/puppet/bin/ruby as shebang which does not exist on the target. Changing the shebang to #! /usr/bin/ruby on the Bolt machine makes the script work.

FredPraca avatar Dec 30 '23 23:12 FredPraca

The problem seems to be in fact that Puppet is not currently officially ported to Debian 12 Bookworm as there is no puppet-release-bookworm.deb on apt.puppet.com. So installing Puppet from Bolt requires to configure the plugin-hooks to use the task plugin with the package task. It installs Ruby as /usr/bin/ruby so the expected ruby path in the custom_facts.rb does not exist.

FredPraca avatar Dec 31 '23 00:12 FredPraca

Did you try upgrading the puppet_agent package to >= 4.17.0 ? https://github.com/puppetlabs/puppetlabs-puppet_agent/commit/43fbd9305f14e8599115179ddc1cf3dac56e7584 Bolt ships with an older one, but if you install a newer one into your project that should be used.

donoghuc avatar Jan 02 '24 19:01 donoghuc

I'm not sure what I have to do but I added puppetlabs-puppet_agent to my PuppetFile and ran bolt module install --no-resolve. The problem remains so I maybe done it the wrong way.

FredPraca avatar Jan 03 '24 20:01 FredPraca

Still not fixed in bolt 3.28. Plan still fails as there's a hardcoded download url. Missing case for bookworm results in /modules/puppet_agent/tasks/install_shell.sh attempting to download https://apt.puppet.com/puppet-release-.deb

Adding the missing case to the script (here), then the missing package file at https://apt.puppet.com/puppet-release-bookworm.deb can be worked around by adding the following to inventory.yaml

plugin_hooks:
    puppet_library:
        plugin: task
        task: puppet_agent::install
        parameters:
            collection: puppet7  # or puppet8

ibuclaw avatar Mar 20 '24 10:03 ibuclaw

Working with bolt 3.29.0.

h0tw1r3 avatar May 03 '24 06:05 h0tw1r3

Yeah, the updated puppet_agent package was included in latest bolt release.

donoghuc avatar May 06 '24 22:05 donoghuc