summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-07-23 21:00:10 -0700
committerJohn Southworth <john.southworth@vyatta.com>2011-07-23 21:00:10 -0700
commitce7b72eb71af9c5f7bf9ab0f423ec44c955a4b9a (patch)
tree9b0d64b93c5871a9b738fb711d6e06fa64025522
parentcf6a189183122b6316ed8819dcdec19527f2e0c5 (diff)
downloadvyatta-cfg-ce7b72eb71af9c5f7bf9ab0f423ec44c955a4b9a.tar.gz
vyatta-cfg-ce7b72eb71af9c5f7bf9ab0f423ec44c955a4b9a.zip
Bugfix 7362: Make reset_paths reset to root level when resolving varrefs
-rw-r--r--src/cstore/cstore-varref.cpp2
-rw-r--r--src/cstore/cstore.hpp2
-rw-r--r--src/cstore/unionfs/cstore-unionfs.hpp12
3 files changed, 13 insertions, 3 deletions
diff --git a/src/cstore/cstore-varref.cpp b/src/cstore/cstore-varref.cpp
index f4a6918..4ece3b0 100644
--- a/src/cstore/cstore-varref.cpp
+++ b/src/cstore/cstore-varref.cpp
@@ -47,7 +47,7 @@ Cstore::VarRef::VarRef(Cstore *cstore, const string& ref_str, bool active)
_orig_path_comps.push(tmp.back());
tmp.pop_back();
}
- _cstore->reset_paths();
+ _cstore->reset_paths(true);
/* at this point, cstore paths are at root. _orig_path_comps contains
* the path originally in cstore (or empty if _absolute).
*/
diff --git a/src/cstore/cstore.hpp b/src/cstore/cstore.hpp
index d6f6d67..228a6c3 100644
--- a/src/cstore/cstore.hpp
+++ b/src/cstore/cstore.hpp
@@ -339,7 +339,7 @@ private:
virtual void pop_cfg_path() = 0;
virtual void pop_cfg_path(string& last) = 0;
virtual void append_cfg_path(const Cpath& path_comps) = 0;
- virtual void reset_paths() = 0;
+ virtual void reset_paths(bool to_root = true) = 0;
virtual auto_ptr<SavePaths> create_save_paths() = 0;
virtual bool cfg_path_at_root() = 0;
virtual bool tmpl_path_at_root() = 0;
diff --git a/src/cstore/unionfs/cstore-unionfs.hpp b/src/cstore/unionfs/cstore-unionfs.hpp
index 1240488..c56f060 100644
--- a/src/cstore/unionfs/cstore-unionfs.hpp
+++ b/src/cstore/unionfs/cstore-unionfs.hpp
@@ -154,7 +154,17 @@ private:
push_cfg_path(path_comps[i]);
}
};
- void reset_paths() {
+ void reset_paths(bool to_root=false) {
+ if (to_root){
+ char *val;
+ if ((val = getenv(C_ENV_TMPL_ROOT.c_str()))) {
+ tmpl_path = val;
+ } else {
+ tmpl_path = C_DEF_TMPL_ROOT;
+ }
+ orig_tmpl_path = val;
+ orig_mutable_cfg_path = "/";
+ }
tmpl_path = orig_tmpl_path;
mutable_cfg_path = orig_mutable_cfg_path;
};