Skip to content

[Backport 7.x] Use agents beaker DSL method #9245

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

Merged
merged 1 commit into from
Feb 6, 2024
Merged

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented Feb 6, 2024

Description

Backport of #9244 to 7.x.

Beaker's singular `agent` DSL 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 with `redhat7-64m-ubuntu2004-64a`, then it will return
a single host. If running with `redhat7-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

(cherry picked from commit e3652a0)
@github-actions github-actions bot requested a review from a team as a code owner February 6, 2024 19:26
@puppetlabs-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@mhashizume mhashizume closed this Feb 6, 2024
@mhashizume mhashizume reopened this Feb 6, 2024
@mhashizume mhashizume added the maintenance Maintenance chores are excluded from changelogs label Feb 6, 2024
@mhashizume mhashizume merged commit 3950b39 into 7.x Feb 6, 2024
@mhashizume mhashizume deleted the backport-9244-to-7.x branch February 6, 2024 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance chores are excluded from changelogs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants