1 /*************************************************************************
3 * Copyright 2020 highstreet technologies GmbH and others
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 ***************************************************************************/
20 #include "supervisor.h"
21 #include "utils/log_utils.h"
22 #include "utils/sys_utils.h"
26 #include "core/session.h"
27 #include "core/xpath.h"
28 #include "core/framework.h"
30 static int app_common_populate_info(void);
32 int app_common_init(void) {
35 int rc = app_common_populate_info();
36 if(rc != NTS_ERR_OK) {
37 log_error("app_common_populate_info() failed\n");
38 return NTS_ERR_FAILED;
44 static int app_common_populate_info(void) {
46 if (framework_environment.nts.build_time && strlen(framework_environment.nts.build_time) > 0) {
47 rc = sr_set_item_str(session_operational, NTS_NF_INFO_BUILD_TIME_XPATH, framework_environment.nts.build_time, 0, 0);
49 log_error("sr_set_item_str failed\n");
50 return NTS_ERR_FAILED;
54 rc = sr_set_item_str(session_operational, NTS_NF_INFO_VERSION_XPATH, framework_environment.nts.version, 0, 0);
56 log_error("sr_set_item_str failed\n");
57 return NTS_ERR_FAILED;
60 rc = sr_apply_changes(session_operational, 0, 0);
62 log_error("sr_apply_changes failed: %s\n", sr_strerror(rc));
63 return NTS_ERR_FAILED;