Skip to content

Commit

Permalink
Add env var for puppet package name
Browse files Browse the repository at this point in the history
This is useful for two setups:
* someone has their own package and wants to test with that
* someone has beaker instances with the puppet-agent preinstalled
  • Loading branch information
bastelfreak committed Oct 24, 2023
1 parent 99bb6e3 commit acd7b13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Other common environment variables:
* `BEAKER_PROVISION` can be set to `no` to reuse a box. Note that the box must exist already. See `BEAKER_DESTROY`
* `BEAKER_SETFILE` is used to point to a setfile containing definitions. To avoid storing large YAML files in all repositories, [beaker-hostgenerator](https://github.com/voxpupuli/beaker-hostgenerator) is used to generate them on the fly when the file is not present.
* `BEAKER_PUPPET_COLLECTION` defines the puppet collection that will be configured, defaults to `puppet`. When set to `none`, no repository will be configured and distro package naming is assumed. When set to `preinstalled`, it assumes the OS is already set up with a collection but it still ensures `puppet-agent` is installed.
* `BEAKER_PUPPET_PACKAGE_NAME` optional env var to set the puppet agent package name. If not set, the package name will be searched in [puppet_metadata](https://github.com/voxpupuli/puppet_metadata#puppet_metadata).

Since it's still plain [RSpec](https://rspec.info/), it is also possible to call an individual test file:

Expand Down
2 changes: 1 addition & 1 deletion lib/voxpupuli/acceptance/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def configure_beaker(modules: :metadata, &block)
unless %w[none preinstalled].include?(collection)
BeakerPuppetHelpers::InstallUtils.install_puppet_release_repo_on(host, collection)
end
package_name = BeakerPuppetHelpers::InstallUtils.puppet_package_name(host, prefer_aio: collection != 'none')
package_name = ENV.fetch('BEAKER_PUPPET_PACKAGE_NAME', BeakerPuppetHelpers::InstallUtils.puppet_package_name(host, prefer_aio: collection != 'none'))
host.install_package(package_name)

# by default, puppet-agent creates /etc/profile.d/puppet-agent.sh which adds /opt/puppetlabs/bin to PATH
Expand Down

0 comments on commit acd7b13

Please sign in to comment.