repmgr: cluster check commands - non-zero exit code if node(s) unavailable

Return ERR_CLUSTER_CHECK if one or nodes was not reachable.

Implements GitHub #447.
This commit is contained in:
Ian Barwick
2018-06-11 12:39:35 +09:00
parent 00704913a6
commit 3b0cde2846
7 changed files with 117 additions and 20 deletions

View File

@@ -569,6 +569,8 @@ do_cluster_crosscheck(void)
t_node_status_cube **cube;
bool error_found = false;
n = build_cluster_crosscheck(&cube, &name_length);
if (runtime_options.output_mode == OM_CSV)
{
@@ -648,9 +650,11 @@ do_cluster_crosscheck(void)
{
case -2:
c = '?';
error_found = true;
break;
case -1:
c = 'x';
error_found = true;
break;
case 0:
c = '*';
@@ -689,6 +693,11 @@ do_cluster_crosscheck(void)
free(cube);
}
if (error_found == true)
{
exit(ERR_CLUSTER_CHECK);
}
}
@@ -704,6 +713,8 @@ do_cluster_matrix()
t_node_matrix_rec **matrix_rec_list;
bool error_found = false;
n = build_cluster_matrix(&matrix_rec_list, &name_length);
if (runtime_options.output_mode == OM_CSV)
@@ -742,9 +753,11 @@ do_cluster_matrix()
{
case -2:
c = '?';
error_found = true;
break;
case -1:
c = 'x';
error_found = true;
break;
case 0:
c = '*';
@@ -770,6 +783,11 @@ do_cluster_matrix()
}
free(matrix_rec_list);
if (error_found == true)
{
exit(ERR_CLUSTER_CHECK);
}
}