- //either get values, or if data inconclusive, delete everything
- if(value_count) {
- log_message(2, "nts-manager instances found (%d). cleaning up for fresh start...\n", value_count);
-
- for(int i = 0; i < value_count; i++) {
- rc = sr_delete_item(session_running, values[i].xpath, 0);
- if(rc != SR_ERR_OK) {
- log_error("sr_delete_item failed");
- return NTS_ERR_FAILED;
- }
- }
- rc = sr_apply_changes(session_running, 0, 0);
- if(rc != SR_ERR_OK) {
- log_error("sr_apply_changes failed");
- return NTS_ERR_FAILED;
- }
- }
-
- //populate everything if needed
- for(int i = 0; i < manager_installed_function_types_count; i++) {
- char *xpath = 0;
-
- asprintf(&xpath, "%s[function-type='%s']/function-type", NTS_FUNCTION_LIST_SCHEMA_XPATH, manager_context[i].function_type_string);
- rc = sr_set_item_str(session_running, xpath, (const char *)manager_context[i].function_type_string, 0, 0);
- if(rc != SR_ERR_OK) {
- log_error("sr_set_item_str failed");
- return NTS_ERR_FAILED;
- }
- free(xpath);
-
- asprintf(&xpath, "%s[function-type='%s']/started-instances", NTS_FUNCTION_LIST_SCHEMA_XPATH, manager_context[i].function_type_string);
- rc = sr_set_item_str(session_running, xpath, "0", 0, 0);
- if(rc != SR_ERR_OK) {
- log_error("sr_set_item_str failed");
- return NTS_ERR_FAILED;
- }
- free(xpath);
-
- asprintf(&xpath, "%s[function-type='%s']/mounted-instances", NTS_FUNCTION_LIST_SCHEMA_XPATH, manager_context[i].function_type_string);
- rc = sr_set_item_str(session_running, xpath, "0", 0, 0);
- if(rc != SR_ERR_OK) {
- log_error("sr_set_item_str failed");
- return NTS_ERR_FAILED;
- }
- free(xpath);
-
- asprintf(&xpath, "%s[function-type='%s']/mount-point-addressing-method", NTS_FUNCTION_LIST_SCHEMA_XPATH, manager_context[i].function_type_string);
- rc = sr_set_item_str(session_running, xpath, (const char*)manager_context[i].mount_point_addressing_method, 0, 0);
- if(rc != SR_ERR_OK) {
- log_error("sr_set_item_str failed");
- return NTS_ERR_FAILED;
- }
- free(xpath);
-
- asprintf(&xpath, "%s[function-type='%s']/docker-instance-name", NTS_FUNCTION_LIST_SCHEMA_XPATH, manager_context[i].function_type_string);
- rc = sr_set_item_str(session_running, xpath, (const char*)manager_context[i].docker_instance_name, 0, 0);
- if(rc != SR_ERR_OK) {
- log_error("sr_set_item_str failed");
- return NTS_ERR_FAILED;
- }
- free(xpath);
-
- asprintf(&xpath, "%s[function-type='%s']/docker-version-tag", NTS_FUNCTION_LIST_SCHEMA_XPATH, manager_context[i].function_type_string);
- rc = sr_set_item_str(session_running, xpath, (const char*)manager_context[i].docker_version_tag, 0, 0);
- if(rc != SR_ERR_OK) {
- log_error("sr_set_item_str failed");
- return NTS_ERR_FAILED;
- }
- free(xpath);
-
- asprintf(&xpath, "%s[function-type='%s']/docker-repository", NTS_FUNCTION_LIST_SCHEMA_XPATH, manager_context[i].function_type_string);
- rc = sr_set_item_str(session_running, xpath, (const char*)manager_context[i].docker_repository, 0, 0);
- if(rc != SR_ERR_OK) {
- log_error("sr_set_item_str failed");
- return NTS_ERR_FAILED;
+ //print everything on the manager's screen
+ log_add_verbose(1, LOG_COLOR_BOLD_CYAN"Available images: \n"LOG_COLOR_RESET);
+ for(int i = 0; i < docker_context_count; i++) {
+ log_add_verbose(1, LOG_COLOR_BOLD_CYAN"- %s\n"LOG_COLOR_RESET, docker_context[i].image);
+ for(int j = 0; j < docker_context[i].available_images_count; j++) {
+ log_add_verbose(1, " - "LOG_COLOR_RED"%s/"LOG_COLOR_CYAN"%s"LOG_COLOR_RESET":"LOG_COLOR_YELLOW"%s\n"LOG_COLOR_RESET, docker_context[i].available_images[j].repo, docker_context[i].image, docker_context[i].available_images[j].tag);