Skip to content

Commit

Permalink
New beaker helper bolt_supported
Browse files Browse the repository at this point in the history
Can be used in `spec/spec_helper_acceptance.rb` as:

```ruby
if bolt_supported(host)
  host.install_package('puppet-bolt')
end
```

bolt_supported returns `true` or `false` depending on if a bolt package
is available for a particular platform.
  • Loading branch information
traylenator committed Apr 30, 2024
1 parent 4e147f7 commit 52cd06d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/beaker_puppet_helpers/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,30 @@ def fact_on(host, name, opts = {})
def fact(name, opts = {})
fact_on(default, name, opts)
end

# Show if bolt package is available
#
# @param [Beaker::Host] host
# @return True if package is available.
#
def bolt_supported?(host = default)
#
# Supported platforms
# https://github.com/puppetlabs/bolt/blob/main/documentation/bolt_installing.md
# https://github.com/puppetlabs/bolt-vanagon/tree/main/configs/platforms

case host['packaging_platform'].split('-', 3)[0, 1]
when %w[el 7], %w[el 8], %w[el 9],
%w[debian 10], %w[debian 11],
['ubuntu', '20.04'], ['ubuntu', '22.04'],
%w[osx 11], %w[osx 12],
%w[sles 12], %w[sles 15],
%w[fedora 36],
%w[windows 2012r2]
true
else
false
end
end
end
end

0 comments on commit 52cd06d

Please sign in to comment.