Skip to content

Commit

Permalink
ietf-system-augeas: move hostname load functionality to the augeas sp…
Browse files Browse the repository at this point in the history
…ecific plugin
  • Loading branch information
zinccyy committed Feb 9, 2023
1 parent 3e47766 commit e375ec7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/plugins/ietf-system-augeas/datastore/running/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

// core library
#include "core/ly_tree.h"
#include "core/api/system/load.h"
#include "core/api/system/ntp/load.h"
#include "core/data/system/ntp/server/list.h"

Expand Down Expand Up @@ -89,6 +90,29 @@ int system_aug_running_ds_load(system_ctx_t *ctx, sr_session_ctx_t *session)

static int system_aug_running_load_hostname(void *priv, sr_session_ctx_t *session, const struct ly_ctx *ly_ctx, struct lyd_node *parent_node)
{
int error = 0;
system_ctx_t *ctx = (system_ctx_t *) priv;
char hostname_buffer[SYSTEM_HOSTNAME_LENGTH_MAX] = {0};

error = system_load_hostname(ctx, hostname_buffer);
if (error) {
SRPLG_LOG_ERR(PLUGIN_NAME, "system_load_hostname() error (%d)", error);
goto error_out;
}

error = system_ly_tree_create_hostname(ly_ctx, parent_node, hostname_buffer);
if (error) {
SRPLG_LOG_ERR(PLUGIN_NAME, "system_ly_tree_create_hostname() error (%d)", error);
goto error_out;
}

goto out;

error_out:
error = -1;

out:
return error;
}

static int system_aug_running_load_ntp(void *priv, sr_session_ctx_t *session, const struct ly_ctx *ly_ctx, struct lyd_node *parent_node)
Expand Down

0 comments on commit e375ec7

Please sign in to comment.