Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Beaker's singular
agent
method can either return a single host or an array of hosts, depending on how many hosts have the agent role in your beaker config. For example, when running withredhat7-64m-ubuntu2004-64a
, then it will return a single host. If running withredhat7-64ma-ubuntu2004-64a
, then it will return an array of hosts[1].The beaker
agent
method should never be used as it can cause tests to pass in agent CI, but fail in puppetserver CI, since they test the agent running on the server host.Instead reference the
agents
method, which is guaranteed to exist and return an array, possible empty.Also use the
fact_on
helper which parses the facter output as JSON and avoids having to chomp newlines in the output.[1] https://github.com/voxpupuli/beaker/blob/abd5b30e93061b44e45f2211bc6a73cb6e20b353/lib/beaker/dsl/roles.rb#L181-L187