curl_easy_reset(curl);
set_curl_common_info();
- char url[100];
- sprintf(url, "http:/v%s/containers/NTS_Manager/json", getenv("DOCKER_ENGINE_VERSION"));
+ char url[200];
+ sprintf(url, "http:/v%s/containers/%s/json", getenv("DOCKER_ENGINE_VERSION"), getenv("HOSTNAME"));
curl_easy_setopt(curl, CURLOPT_URL, url);
return NULL;
}
+ if (cJSON_AddStringToObject(labels, "NTS_Manager", getenv("HOSTNAME")) == NULL)
+ {
+ printf("Could not create JSON object: NTS Manager\n");
+ return NULL;
+ }
+
cJSON *env_variables_array = cJSON_CreateArray();
if (env_variables_array == NULL)
{
if (rc != SR_ERR_OK)
{
printf("Could not set the operational state for the device with uuid=\"%s\"\n", container_id_short);
+ return SR_ERR_OPERATION_FAILED;
}
}
}
if (!cJSON_IsObject(notifConfig))
{
printf("Configuration JSON is not as expected: notification-config is not an object");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
if (!cJSON_IsNumber(faultNotifDelay))
{
printf("Configuration JSON is not as expected: fault-notification-delay-period is not an object");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
stringConfiguration = cJSON_Print(jsonConfig);
writeConfigFile(stringConfiguration);
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OK;
}
if (!cJSON_IsObject(notifConfig))
{
printf("Configuration JSON is not as expected: notification-config is not an object");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
if (!cJSON_IsNumber(vesHeartbeatPeriod))
{
printf("Configuration JSON is not as expected: ves-heartbeat-period is not an object");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
stringConfiguration = cJSON_Print(jsonConfig);
writeConfigFile(stringConfiguration);
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OK;
}
if (!cJSON_IsObject(vesDetails))
{
printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
if (!cJSON_IsString(vesIp))
{
printf("Configuration JSON is not as expected: ves-endpoint-ip is not a string");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
stringConfiguration = cJSON_Print(jsonConfig);
writeConfigFile(stringConfiguration);
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OK;
}
if (!cJSON_IsObject(vesDetails))
{
printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
if (!cJSON_IsNumber(vesPort))
{
printf("Configuration JSON is not as expected: ves-endpoint-port is not a number.");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
stringConfiguration = cJSON_Print(jsonConfig);
writeConfigFile(stringConfiguration);
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OK;
}
if (!cJSON_IsObject(vesDetails))
{
printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
if (!cJSON_IsBool(vesRegistration))
{
printf("Configuration JSON is not as expected: ves-registration is not a bool.");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
stringConfiguration = cJSON_Print(jsonConfig);
writeConfigFile(stringConfiguration);
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OK;
}
if (!cJSON_IsObject(notifConfig))
{
printf("Configuration JSON is not as expected: notification-config is not an object");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
if (!cJSON_IsBool(isNetconfAvailable))
{
printf("Configuration JSON is not as expected: is-netconf-available is not a bool.");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
stringConfiguration = cJSON_Print(jsonConfig);
writeConfigFile(stringConfiguration);
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OK;
}
if (!cJSON_IsObject(notifConfig))
{
printf("Configuration JSON is not as expected: notification-config is not an object");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
if (!cJSON_IsBool(isVesAvailable))
{
printf("Configuration JSON is not as expected: is-ves-available is not a bool.");
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OPERATION_FAILED;
}
stringConfiguration = cJSON_Print(jsonConfig);
writeConfigFile(stringConfiguration);
- free(jsonConfig);
+ cJSON_Delete(jsonConfig);
return SR_ERR_OK;
}