mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 17:06:29 +00:00
Miscellaneous code cleanup
This commit is contained in:
10
configfile.c
10
configfile.c
@@ -41,7 +41,7 @@ progname(void)
|
|||||||
return _progname;
|
return _progname;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
void
|
||||||
load_config(const char *config_file, bool verbose, bool terse, t_configuration_options *options, char *argv0)
|
load_config(const char *config_file, bool verbose, bool terse, t_configuration_options *options, char *argv0)
|
||||||
{
|
{
|
||||||
struct stat stat_config;
|
struct stat stat_config;
|
||||||
@@ -160,11 +160,13 @@ load_config(const char *config_file, bool verbose, bool terse, t_configuration_o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parse_config(options, terse);
|
parse_config(options, terse);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
void
|
||||||
parse_config(t_configuration_options *options, bool terse)
|
parse_config(t_configuration_options *options, bool terse)
|
||||||
{
|
{
|
||||||
/* Collate configuration file errors here for friendlier reporting */
|
/* Collate configuration file errors here for friendlier reporting */
|
||||||
@@ -186,7 +188,7 @@ parse_config(t_configuration_options *options, bool terse)
|
|||||||
print_item_list(&config_warnings);
|
print_item_list(&config_warnings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -157,8 +157,8 @@ typedef struct
|
|||||||
void set_progname(const char *argv0);
|
void set_progname(const char *argv0);
|
||||||
const char *progname(void);
|
const char *progname(void);
|
||||||
|
|
||||||
bool load_config(const char *config_file, bool verbose, bool terse, t_configuration_options *options, char *argv0);
|
void load_config(const char *config_file, bool verbose, bool terse, t_configuration_options *options, char *argv0);
|
||||||
bool parse_config(t_configuration_options *options, bool terse);
|
void parse_config(t_configuration_options *options, bool terse);
|
||||||
bool reload_config(t_configuration_options *orig_options);
|
bool reload_config(t_configuration_options *orig_options);
|
||||||
|
|
||||||
|
|
||||||
@@ -176,4 +176,5 @@ bool parse_pg_basebackup_options(const char *pg_basebackup_options,
|
|||||||
/* called by repmgr-client and repmgrd */
|
/* called by repmgr-client and repmgrd */
|
||||||
void exit_with_cli_errors(ItemList *error_list);
|
void exit_with_cli_errors(ItemList *error_list);
|
||||||
void print_item_list(ItemList *item_list);
|
void print_item_list(ItemList *item_list);
|
||||||
#endif
|
|
||||||
|
#endif /* _REPMGR_CONFIGFILE_H_ */
|
||||||
|
|||||||
@@ -76,8 +76,6 @@ main(int argc, char **argv)
|
|||||||
int action = NO_ACTION;
|
int action = NO_ACTION;
|
||||||
char *dummy_action = "";
|
char *dummy_action = "";
|
||||||
|
|
||||||
bool config_file_parsed = false;
|
|
||||||
|
|
||||||
set_progname(argv[0]);
|
set_progname(argv[0]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -730,11 +728,11 @@ main(int argc, char **argv)
|
|||||||
* however if available we'll parse it anyway for options like 'log_level',
|
* however if available we'll parse it anyway for options like 'log_level',
|
||||||
* 'use_replication_slots' etc.
|
* 'use_replication_slots' etc.
|
||||||
*/
|
*/
|
||||||
config_file_parsed = load_config(runtime_options.config_file,
|
load_config(runtime_options.config_file,
|
||||||
runtime_options.verbose,
|
runtime_options.verbose,
|
||||||
runtime_options.terse,
|
runtime_options.terse,
|
||||||
&config_file_options,
|
&config_file_options,
|
||||||
argv[0]);
|
argv[0]);
|
||||||
|
|
||||||
/* Some configuration file items can be overriden by command line options */
|
/* Some configuration file items can be overriden by command line options */
|
||||||
/* Command-line parameter -L/--log-level overrides any setting in config file*/
|
/* Command-line parameter -L/--log-level overrides any setting in config file*/
|
||||||
@@ -1288,6 +1286,7 @@ do_help(void)
|
|||||||
#endif
|
#endif
|
||||||
printf(_(" %s [OPTIONS] bdr register\n"), progname());
|
printf(_(" %s [OPTIONS] bdr register\n"), progname());
|
||||||
printf(_(" %s [OPTIONS] bdr unregister\n"), progname());
|
printf(_(" %s [OPTIONS] bdr unregister\n"), progname());
|
||||||
|
printf(_(" %s [OPTIONS] cluster show\n"), progname());
|
||||||
printf(_(" %s [OPTIONS] cluster event\n"), progname());
|
printf(_(" %s [OPTIONS] cluster event\n"), progname());
|
||||||
|
|
||||||
puts("");
|
puts("");
|
||||||
@@ -1396,6 +1395,7 @@ create_repmgr_extension(PGconn *conn)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* 4. Create extension */
|
/* 4. Create extension */
|
||||||
|
|
||||||
initPQExpBuffer(&query);
|
initPQExpBuffer(&query);
|
||||||
|
|
||||||
wrap_ddl_query(&query, config_file_options.replication_type,
|
wrap_ddl_query(&query, config_file_options.replication_type,
|
||||||
@@ -1631,7 +1631,6 @@ get_superuser_connection(PGconn **conn, PGconn **superuser_conn, PGconn **privil
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX largely duplicated from create_repmgr_extension()
|
|
||||||
if (runtime_options.superuser[0] == '\0')
|
if (runtime_options.superuser[0] == '\0')
|
||||||
{
|
{
|
||||||
log_error(_("\"%s\" is not a superuser and no superuser name supplied"), userinfo.username);
|
log_error(_("\"%s\" is not a superuser and no superuser name supplied"), userinfo.username);
|
||||||
|
|||||||
Reference in New Issue
Block a user