[lxc-devel] [patch 6/7] Add variables resolution info config file
Andrian Nord
nightnord at gmail.com
Mon Dec 7 10:52:22 UTC 2009
This relies on config.include patch, as it's itroducing parsing state,
but it's not nessesary for operation
Signed-off-by: Andrian Nord <NightNord at gmail.com>
diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 7b954b1..ed3fc63 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -35,6 +35,7 @@
#include "config.h"
#include "parse.h"
+#include "variables.h"
#include <lxc/log.h>
#include <lxc/conf.h>
@@ -571,7 +585,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;
@@ -601,7 +617,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