mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 16:16:29 +00:00
Add diagnostic option "repmgr node check --has-passfile"
This checks if the active libpq version (9.6 and later) has the "passfile" option, and returns 0 if present, 1 if not. `
This commit is contained in:
@@ -700,7 +700,7 @@ has_passfile(void)
|
|||||||
|
|
||||||
PQconninfoFree(defs);
|
PQconninfoFree(defs);
|
||||||
|
|
||||||
return has_passfile;
|
return has_passfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -564,6 +564,15 @@ do_node_check(void)
|
|||||||
CheckStatusListCell *cell = NULL;
|
CheckStatusListCell *cell = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/* internal */
|
||||||
|
if (runtime_options.has_passfile == true)
|
||||||
|
{
|
||||||
|
return_code = has_passfile() ? 0 : 1;
|
||||||
|
|
||||||
|
exit(return_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (strlen(config_file_options.conninfo))
|
if (strlen(config_file_options.conninfo))
|
||||||
conn = establish_db_connection(config_file_options.conninfo, true);
|
conn = establish_db_connection(config_file_options.conninfo, true);
|
||||||
else
|
else
|
||||||
@@ -587,8 +596,8 @@ do_node_check(void)
|
|||||||
if (runtime_options.archive_ready == true)
|
if (runtime_options.archive_ready == true)
|
||||||
{
|
{
|
||||||
return_code = do_node_check_archive_ready(conn,
|
return_code = do_node_check_archive_ready(conn,
|
||||||
runtime_options.output_mode,
|
runtime_options.output_mode,
|
||||||
NULL);
|
NULL);
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
exit(return_code);
|
exit(return_code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ typedef struct
|
|||||||
bool replication_lag;
|
bool replication_lag;
|
||||||
bool role;
|
bool role;
|
||||||
bool slots;
|
bool slots;
|
||||||
|
bool has_passfile;
|
||||||
|
|
||||||
/* "node join" options */
|
/* "node join" options */
|
||||||
char config_files[MAXLEN];
|
char config_files[MAXLEN];
|
||||||
@@ -151,7 +152,7 @@ typedef struct
|
|||||||
/* "node status" options */ \
|
/* "node status" options */ \
|
||||||
false, \
|
false, \
|
||||||
/* "node check" options */ \
|
/* "node check" options */ \
|
||||||
false, false, false, false, false, \
|
false, false, false, false, false, false, \
|
||||||
/* "node join" options */ \
|
/* "node join" options */ \
|
||||||
"", \
|
"", \
|
||||||
/* "node service" options */ \
|
/* "node service" options */ \
|
||||||
|
|||||||
@@ -447,6 +447,10 @@ main(int argc, char **argv)
|
|||||||
runtime_options.slots = true;
|
runtime_options.slots = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPT_HAS_PASSFILE:
|
||||||
|
runtime_options.has_passfile = true;
|
||||||
|
break;
|
||||||
|
|
||||||
/*--------------------
|
/*--------------------
|
||||||
* "node rejoin" options
|
* "node rejoin" options
|
||||||
*--------------------
|
*--------------------
|
||||||
@@ -1316,7 +1320,7 @@ check_cli_parameters(const int action)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX if -D/--pgdata provided, and also
|
* XXX if -D/--pgdata provided, and also
|
||||||
* config_file_options.pgdaga, warn -D/--pgdata will be
|
* config_file_options.pgdata, warn -D/--pgdata will be
|
||||||
* ignored
|
* ignored
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1356,6 +1360,12 @@ check_cli_parameters(const int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NODE_CHECK:
|
||||||
|
if (runtime_options.has_passfile == true)
|
||||||
|
{
|
||||||
|
config_file_required = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case NODE_STATUS:
|
case NODE_STATUS:
|
||||||
if (runtime_options.node_id != UNKNOWN_NODE_ID)
|
if (runtime_options.node_id != UNKNOWN_NODE_ID)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,6 +81,7 @@
|
|||||||
#define OPT_DOWNSTREAM 1032
|
#define OPT_DOWNSTREAM 1032
|
||||||
#define OPT_SLOTS 1033
|
#define OPT_SLOTS 1033
|
||||||
#define OPT_CONFIG_ARCHIVE_DIR 1034
|
#define OPT_CONFIG_ARCHIVE_DIR 1034
|
||||||
|
#define OPT_HAS_PASSFILE 1035
|
||||||
/* deprecated since 3.3 */
|
/* deprecated since 3.3 */
|
||||||
#define OPT_DATA_DIR 999
|
#define OPT_DATA_DIR 999
|
||||||
#define OPT_NO_CONNINFO_PASSWORD 998
|
#define OPT_NO_CONNINFO_PASSWORD 998
|
||||||
@@ -153,6 +154,7 @@ static struct option long_options[] =
|
|||||||
{"replication-lag", no_argument, NULL, OPT_REPLICATION_LAG},
|
{"replication-lag", no_argument, NULL, OPT_REPLICATION_LAG},
|
||||||
{"role", no_argument, NULL, OPT_ROLE},
|
{"role", no_argument, NULL, OPT_ROLE},
|
||||||
{"slots", no_argument, NULL, OPT_SLOTS},
|
{"slots", no_argument, NULL, OPT_SLOTS},
|
||||||
|
{"has-passfile", no_argument, NULL, OPT_HAS_PASSFILE},
|
||||||
|
|
||||||
/* "node rejoin" options */
|
/* "node rejoin" options */
|
||||||
{"config-files", required_argument, NULL, OPT_CONFIG_FILES},
|
{"config-files", required_argument, NULL, OPT_CONFIG_FILES},
|
||||||
|
|||||||
Reference in New Issue
Block a user