mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-01 05:13:01 +02:00
confd: Consistently use srx_require_modules
This allows confd to start without errors when modules are already loaded.
This commit is contained in:
committed by
Joachim Wiberg
parent
def761b067
commit
f40841e5e7
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#include "core.h"
|
||||
#include "srx_module.h"
|
||||
|
||||
static struct confd confd;
|
||||
|
||||
@@ -22,6 +23,12 @@ static int commit_done_hook(sr_session_ctx_t *session, uint32_t sub_id, const ch
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
static const struct srx_module_requirement core_reqs[] = {
|
||||
{ .dir = YANG_PATH_, .name = "kernelkit-infix-deviations", .rev = "2023-04-03" },
|
||||
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
int sr_plugin_init_cb(sr_session_ctx_t *session, void **priv)
|
||||
{
|
||||
sr_session_ctx_t *startup;
|
||||
@@ -77,7 +84,7 @@ int sr_plugin_init_cb(sr_session_ctx_t *session, void **priv)
|
||||
goto err;
|
||||
}
|
||||
|
||||
rc = sr_install_module(confd.conn, YANG_PATH_"/kernelkit-infix-deviations.yang", NULL, NULL);
|
||||
rc = srx_require_modules(confd.conn, core_reqs);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
|
||||
+18
-13
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#include "core.h"
|
||||
#include "srx_module.h"
|
||||
#include "srx_val.h"
|
||||
|
||||
#include <ctype.h>
|
||||
@@ -886,16 +887,24 @@ err:
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
static const char *sysfeat[] = {
|
||||
"authentication",
|
||||
"local-users",
|
||||
"ntp",
|
||||
"ntp-udp-port",
|
||||
"timezone-name",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct srx_module_requirement ietf_system_reqs[] = {
|
||||
{ .dir = YANG_PATH_, .name = "ietf-system", .rev = "2014-08-06", .features = sysfeat },
|
||||
{ .dir = YANG_PATH_, .name = "infix-system", .rev = "2014-08-06" },
|
||||
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
int ietf_system_init(struct confd *confd)
|
||||
{
|
||||
const char *features[] = {
|
||||
"authentication",
|
||||
"local-users",
|
||||
"ntp",
|
||||
"ntp-udp-port",
|
||||
"timezone-name",
|
||||
NULL
|
||||
};
|
||||
int rc;
|
||||
|
||||
os_init();
|
||||
@@ -908,11 +917,7 @@ int ietf_system_init(struct confd *confd)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
rc = sr_install_module(confd->conn, YANG_PATH_"/ietf-system@2014-08-06.yang", NULL, features);
|
||||
if (rc)
|
||||
goto fail;
|
||||
/* Augment to ietf-systems */
|
||||
rc = sr_install_module(confd->conn, YANG_PATH_"/infix-system@2014-08-06.yang", NULL, NULL);
|
||||
rc = srx_require_modules(confd->conn, ietf_system_reqs);
|
||||
if (rc)
|
||||
goto fail;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user