mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 08:06:29 +00:00
repmgr: "cluster show" to return non-zero value if an issue encountered
This commit is contained in:
@@ -487,7 +487,7 @@ do_node_status(void)
|
||||
|
||||
termPQExpBuffer(&output);
|
||||
|
||||
if (runtime_options.output_mode == OM_TEXT && warnings.head != NULL && runtime_options.terse == false)
|
||||
if (warnings.head != NULL && runtime_options.terse == false && runtime_options.output_mode == OM_TEXT)
|
||||
{
|
||||
log_warning(_("following issue(s) were detected:"));
|
||||
print_item_list(&warnings);
|
||||
@@ -498,8 +498,20 @@ do_node_status(void)
|
||||
key_value_list_free(&node_status);
|
||||
item_list_free(&warnings);
|
||||
PQfinish(conn);
|
||||
|
||||
/*
|
||||
* If warnings were noted, even if they're not displayed (e.g. in --csv node),
|
||||
* that means something's not right so we need to emit a non-zero exit code.
|
||||
*/
|
||||
if (warnings.head != NULL)
|
||||
{
|
||||
exit(ERR_NODE_STATUS);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns information about the running state of the node.
|
||||
* For internal use during "standby switchover".
|
||||
|
||||
Reference in New Issue
Block a user