diff options
-rw-r--r-- | src/cli_new.c | 2 | ||||
-rw-r--r-- | src/cli_val_engine.c | 2 | ||||
-rw-r--r-- | src/set.c | 16 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/speed/node.def | 2 |
4 files changed, 14 insertions, 8 deletions
diff --git a/src/cli_new.c b/src/cli_new.c index 07f0697..075b7d0 100644 --- a/src/cli_new.c +++ b/src/cli_new.c @@ -1120,7 +1120,7 @@ static int eval_va(valstruct *res, vtw_node *node) status=clind_config_engine_apply_command_path(n_cfg_path, n_tmpl_path, n_cmd_path, - FALSE, + TRUE, &cv, get_cdirp(), get_tdirp(), diff --git a/src/cli_val_engine.c b/src/cli_val_engine.c index d597c68..8090a2a 100644 --- a/src/cli_val_engine.c +++ b/src/cli_val_engine.c @@ -207,7 +207,6 @@ static char** clind_get_current_value(clind_path_ref cfg_path, struct stat statbuf; /* Directory reference: */ - if(!check_existence || (lstat(cfg_path_string, &statbuf) == 0)) { ret=(char**)realloc(ret,sizeof(char*)*1); ret[0]=clind_unescape(cfg_end); @@ -708,7 +707,6 @@ int clind_config_engine_apply_command_path(clind_path_ref cfg_path_orig, if(config_paths[i]) { int vallen=0; - char** valarr=clind_get_current_value(config_paths[i], tmpl_path, check_existence, @@ -49,8 +49,14 @@ boolean set_validate(vtw_def *defp, char *valp, boolean empty_val) clind_path_destruct(&tp); } - pop_path(&t_path); /* it was tag or real value */ - + if (strcmp(path_end, TAG_NAME) == 0) { + /* it was a tag, so the def is at 1 level up */ + pop_path(&t_path); + } else { + /* it's actual value, so the tmpl path is fine */ + free(path_end); + path_end = NULL; + } } push_path(&t_path, DEF_NAME); if (lstat(t_path.path, &statbuf) < 0 || @@ -190,8 +196,10 @@ int main(int argc, char **argv) exit(1); } /*ai == argc -1, must be actual value */ - if (!empty_val) - pop_path(&m_path); /*it was value, not path segment */ + if (!empty_val) { + pop_path(&m_path); /* pop the actual value at the end */ + pop_path(&t_path); /* pop the "node.tag" */ + } if(!set_validate(&def, argv[argc-1], empty_val)) { exit(1); diff --git a/templates/interfaces/ethernet/node.tag/speed/node.def b/templates/interfaces/ethernet/node.tag/speed/node.def index a986490..58347a6 100644 --- a/templates/interfaces/ethernet/node.tag/speed/node.def +++ b/templates/interfaces/ethernet/node.tag/speed/node.def @@ -1,6 +1,6 @@ type: txt help: "set the speed for this interface" syntax: $(@) in "10", "100", "1000"; "Speed must be 10, 100, or 1000" -commit: $(../duplex/@) != ""; "if speed is hardcoded, duplex must also be hardcoded" +commit: $(../duplex) != ""; "if speed is hardcoded, duplex must also be hardcoded" update: "sudo ethtool -s $(../@) speed $(@) duplex $(../duplex/@) autoneg off" delete: "sudo ethtool -s $(../@) autoneg on" |