diff options
author | Kinsey Moore <kmoore@digium.com> | 2013-06-13 18:20:31 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2013-06-13 18:20:31 +0000 |
commit | 8146da860669c19ed3e435c7f2c6ee933bca1a24 (patch) | |
tree | d0220d7b3226627c35ba06f0199e17d85e8c8790 | |
parent | 49949ac5a90d29ef23dc7fe46d802f1c08546352 (diff) |
Ensure that Asterisk still starts up when cel.conf is missing
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391689 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/cel.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/main/cel.c b/main/cel.c index a5e19f115..8aa2336f3 100644 --- a/main/cel.c +++ b/main/cel.c @@ -477,10 +477,6 @@ static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_ struct ast_event_sub *sub; RAII_VAR(struct cel_config *, cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup); - if (!cfg || !cfg->general) { - return CLI_FAILURE; - } - switch (cmd) { case CLI_INIT: e->command = "cel show status"; @@ -500,6 +496,10 @@ static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_ ast_cli(a->fd, "CEL Logging: %s\n", ast_cel_check_enabled() ? "Enabled" : "Disabled"); + if (!cfg || !cfg->general) { + return CLI_SUCCESS; + } + if (!cfg->general->enable) { return CLI_SUCCESS; } @@ -611,7 +611,7 @@ static int apps_handler(const struct aco_option *opt, struct ast_variable *var, static int do_reload(void) { - if (aco_process_config(&cel_cfg_info, 1)) { + if (aco_process_config(&cel_cfg_info, 1) == ACO_PROCESS_ERROR) { return -1; } @@ -1444,19 +1444,6 @@ int ast_cel_engine_init(void) return -1; } - if (aco_info_init(&cel_cfg_info)) { - return -1; - } - - aco_option_register(&cel_cfg_info, "enable", ACO_EXACT, general_options, "no", OPT_BOOL_T, 1, FLDSET(struct cel_general_config, enable)); - aco_option_register(&cel_cfg_info, "dateformat", ACO_EXACT, general_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct cel_general_config, date_format)); - aco_option_register_custom(&cel_cfg_info, "apps", ACO_EXACT, general_options, "", apps_handler, 0); - aco_option_register_custom(&cel_cfg_info, "events", ACO_EXACT, general_options, "", events_handler, 0); - - if (aco_process_config(&cel_cfg_info, 0)) { - return -1; - } - if (ast_cli_register(&cli_status)) { return -1; } @@ -1530,6 +1517,17 @@ int ast_cel_engine_init(void) return -1; } + if (aco_info_init(&cel_cfg_info)) { + return -1; + } + + aco_option_register(&cel_cfg_info, "enable", ACO_EXACT, general_options, "no", OPT_BOOL_T, 1, FLDSET(struct cel_general_config, enable)); + aco_option_register(&cel_cfg_info, "dateformat", ACO_EXACT, general_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct cel_general_config, date_format)); + aco_option_register_custom(&cel_cfg_info, "apps", ACO_EXACT, general_options, "", apps_handler, 0); + aco_option_register_custom(&cel_cfg_info, "events", ACO_EXACT, general_options, "", events_handler, 0); + + aco_process_config(&cel_cfg_info, 0); + ast_register_cleanup(ast_cel_engine_term); return 0; |