mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 07:06:30 +00:00
repmgr: "cluster show" to return non-zero value if an issue encountered
This commit is contained in:
1
HISTORY
1
HISTORY
@@ -4,6 +4,7 @@
|
||||
repmgr: fix "standby register --wait-sync" when no timeout provided (Ian)
|
||||
repmgr: "cluster show" returns non-zero value if an issue encountered;
|
||||
GitHub #456 (Ian)
|
||||
repmgr: "node status" returns non-zero value if an issue encountered (Ian)
|
||||
repmgrd: create a PID file by default; GitHub #457 (Ian)
|
||||
repmgrd: daemonize process by default; GitHub #458 (Ian)
|
||||
|
||||
|
||||
@@ -52,6 +52,35 @@
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Exit codes</title>
|
||||
<para>
|
||||
Following exit codes can be emitted by <command>repmgr node status</command>:
|
||||
</para>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>SUCCESS (0)</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
No issues were detected.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>ERR_NODE_STATUS (25)</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
One or more issues were detected.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1>
|
||||
<title>See also</title>
|
||||
<para>
|
||||
|
||||
@@ -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