34#include "cmdhandler.h"
41#include "clientpipe.h"
42#include "longgetopt.h"
48static const char *module_str =
"update_all_cmd";
61 client_printf(sockfd,
"Perform policy import, update zonelist, and update repositorylist.\n\n");
68 char *zonelist = NULL;
69 char **replist = NULL;
70 char **policy_names = NULL;
75 if (
check_conf(engine->config->cfg_filename, &kasp,
76 &zonelist, &replist, &repcount,
77 (ods_log_verbosity() >= 3)))
78 ods_log_error_and_printf(sockfd, module_str,
79 "Unable to validate '%s' consistency.",
80 engine->config->cfg_filename);
81 else if (
check_kasp(kasp, replist, repcount, 0, &policy_names, &policy_count))
82 ods_log_error_and_printf(sockfd, module_str,
83 "Unable to validate '%s' consistency.", kasp);
85 ods_log_error_and_printf(sockfd, module_str,
86 "Unable to validate '%s' consistency.", zonelist);
92 for (i = 0; i < repcount; i++) free(replist[i]);
96 for (i = 0; i < policy_count; i++) free(policy_names[i]);
102run(cmdhandler_ctx_type* context,
int argc,
char* argv[])
104 int sockfd = context->sockfd;
114 if (!(error = check_all(sockfd, engine))) {
118 pthread_mutex_lock(&engine->signal_lock);
127 engine->need_to_reload = 1;
128 pthread_cond_signal(&engine->signal_cond);
130 pthread_mutex_unlock(&engine->signal_lock);
136 "update all", &usage, &help, NULL, NULL, &run, NULL
struct db_connection db_connection_t
db_connection_t * getconnectioncontext(cmdhandler_ctx_type *context)
engine_type * getglobalcontext(cmdhandler_ctx_type *context)
void engine_start_workers(engine_type *engine)
void engine_stop_workers(engine_type *engine)
struct engine_struct engine_type
int check_kasp(const char *kasp, char **repo_list, int repo_count, int verbose, char ***policy_names_out, int *policy_count_out)
int check_zonelist(const char *zonelist, int verbose, char **policy_names, int policy_count)
int check_conf(const char *conf, char **kasp, char **zonelist, char ***repo_listout, int *repo_countout, int verbose)
int policy_import(int sockfd, engine_type *engine, db_connection_t *dbconn, int do_delete)
struct cmd_func_block update_all_funcblock
int zonelist_import(int sockfd, engine_type *engine, db_connection_t *dbconn, int do_delete, const char *zonelist_path)