-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add function to check if nodes are reachable via bolt #433
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# @summary check if a group of targets are reachable for bolt | ||
# | ||
# @param targets list of targets that are going to be checked | ||
# @param output_details flag to enable/disable error output for failed nodes | ||
# | ||
# @return counter for unavailable nodes | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
# | ||
function peadm::check_availability( | ||
TargetSpec $targets, | ||
Boolean $output_details = true | ||
) >> Integer { | ||
$check_result = wait_until_available($targets, wait_time => 2, _catch_errors => true) | ||
unless $check_result.ok { | ||
$end_message = "${check_result.error_set.count} targets are not reachable, stopping plan" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @bastelfreak I was chatting to our Docs and he has suggested this change for the messaging; Is it possible to update it like this? |
||
fail_plan($end_message, 'peadm/unreachable-nodes', error_set => $check_result.error_set) | ||
} | ||
|
||
return $check_result.error_set.count | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
describe 'basic functionality' do | ||
it 'runs successfully with the minimum required parameters' do | ||
allow_out_message | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is missing:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bastelfreak this too |
||
expect_plan('peadm::subplans::install') | ||
expect_plan('peadm::subplans::configure') | ||
expect(run_plan('peadm::install', 'primary_host' => 'primary', 'console_password' => 'puppetlabs', 'version' => '2021.7.7')).to be_ok | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not peadm specific and I think other plans could benefit from it as well. But I'm not sure which module would be a good place for such a generic function. I think bolt has no generic module where we could add it? Maybe stdlib or extlib are good candidates?