Skip to content
Snippets Groups Projects
Commit 37db3e21 authored by Amin Ben Romdhane's avatar Amin Ben Romdhane
Browse files

Add support for displaying the schema data model with '-d' option

parent fa6a85c1
Branches devel
No related tags found
1 merge request!40Add support for displaying the schema data model with '-d' option
Pipeline #206260 passed
...@@ -253,6 +253,7 @@ static void usage(const char *prog) ...@@ -253,6 +253,7 @@ static void usage(const char *prog)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fprintf(stderr, "options:\n"); fprintf(stderr, "options:\n");
fprintf(stderr, " -l <0-7> Set the loglevel\n"); fprintf(stderr, " -l <0-7> Set the loglevel\n");
fprintf(stderr, " -d <schema dm> Display the schema data model supported by micro-service\n");
fprintf(stderr, " -h Displays this help\n"); fprintf(stderr, " -h Displays this help\n");
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
...@@ -260,9 +261,9 @@ static void usage(const char *prog) ...@@ -260,9 +261,9 @@ static void usage(const char *prog)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int log_level = 7; int log_level = 7;
int c = 0; int c = 0, dm_type = 0;
while ((c = getopt(argc, argv, "hl:")) != -1) { while ((c = getopt(argc, argv, "hdl:")) != -1) {
switch (c) { switch (c) {
case 'l': case 'l':
log_level = (int)strtod(optarg, NULL); log_level = (int)strtod(optarg, NULL);
...@@ -270,6 +271,9 @@ int main(int argc, char **argv) ...@@ -270,6 +271,9 @@ int main(int argc, char **argv)
log_level = 7; log_level = 7;
} }
break; break;
case 'd':
dm_type++;
break;
case 'h': case 'h':
usage(argv[0]); usage(argv[0]);
exit(0); exit(0);
...@@ -278,18 +282,24 @@ int main(int argc, char **argv) ...@@ -278,18 +282,24 @@ int main(int argc, char **argv)
exit(0); exit(0);
} }
} }
load_system_users();
load_system_groups();
memset(&bbfdm_ctx, 0, sizeof(struct bbfdm_context)); memset(&bbfdm_ctx, 0, sizeof(struct bbfdm_context));
create_groups();
create_users();
bbfdm_ubus_set_service_name(&bbfdm_ctx, "usermngr"); bbfdm_ubus_set_service_name(&bbfdm_ctx, "usermngr");
bbfdm_ubus_set_log_level(log_level); bbfdm_ubus_set_log_level(log_level);
bbfdm_ubus_load_data_model(tDynamicObj); bbfdm_ubus_load_data_model(tDynamicObj);
if (dm_type > 0) {
int res = bbfdm_print_data_model_schema(&bbfdm_ctx, dm_type);
exit(res);
}
load_system_users();
load_system_groups();
create_groups();
create_users();
if (bbfdm_ubus_regiter_init(&bbfdm_ctx)) if (bbfdm_ubus_regiter_init(&bbfdm_ctx))
goto out; goto out;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment