[lxc-devel] [patch 3/6] [draft] Add variables resolution in confile fstab
Andrian Nord
nightnord at gmail.com
Mon Nov 16 22:23:46 UTC 2009
This is patch, that adds variables into config file. Still, it's
depending on previous patch that adds config.include (you may see state
structure)
Signed-off-by: Andrian Nord <NightNord at gmail.com>
diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index f2a6f65..f44ae8b 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -38,6 +38,7 @@
#include <lxc/lxc.h>
#include <lxc/log.h>
+#include <lxc/variables.h>
lxc_log_define(lxc_confile, lxc);
@@ -612,7 +613,9 @@ static int parse_line(void *buffer, void *data)
char *line = buffer;
char *dot;
char *key;
- char *value;
+ char *value, *expanded;
+
+ int ret;
if (lxc_is_line_empty(line))
return 0;
@@ -642,7 +645,16 @@ static int parse_line(void *buffer, void *data)
return -1;
}
- return config->cb(key, value, state->lxc_conf);
+ if (lxc_resolve_variables(value, &expanded, state->lxc_conf)) {
+ ERROR("%s: variable resolution failed", state->file);
+ return -1;
+ }
+
+ ret = config->cb(key, expanded, state->lxc_conf);
+
+ free(expanded);
+
+ return ret;
}
int lxc_config_read(const char *file, struct lxc_conf *conf)
More information about the lxc-devel
mailing list