summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2011-05-17 10:20:19 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2011-05-17 10:20:19 -0700
commit9d5b213893a79939ac8f2e871e18ba3163eeab50 (patch)
tree6504ea1e8fc18436cedd4d378752b05d0c8c3e74 /src
parent7a9ad37b1f598ec44ee01fc16ad16526e45f1bf7 (diff)
downloadvyatta-cfg-9d5b213893a79939ac8f2e871e18ba3163eeab50.tar.gz
vyatta-cfg-9d5b213893a79939ac8f2e871e18ba3163eeab50.zip
minor feature etc.
* add commit notification. * fix relative VAR references that traverse up to root level.
Diffstat (limited to 'src')
-rw-r--r--src/commit/commit-algorithm.cpp5
-rw-r--r--src/cstore/cstore-varref.cpp23
2 files changed, 18 insertions, 10 deletions
diff --git a/src/commit/commit-algorithm.cpp b/src/commit/commit-algorithm.cpp
index 80567f0..a5d3415 100644
--- a/src/commit/commit-algorithm.cpp
+++ b/src/commit/commit-algorithm.cpp
@@ -1219,6 +1219,11 @@ commit::doCommit(Cstore& cs, CfgNode& cfg1, CfgNode& cfg2)
cst = ((s > 0) ? "PARTIAL" : "FAILURE");
}
+ if (s > 0) {
+ // notify other users in config mode
+ system("/opt/vyatta/sbin/vyatta-cfg-notify");
+ }
+
if (!cs.commitConfig(proot)) {
OUTPUT_USER("Failed to generate committed config\n");
ret = false;
diff --git a/src/cstore/cstore-varref.cpp b/src/cstore/cstore-varref.cpp
index 7549834..efe1b04 100644
--- a/src/cstore/cstore-varref.cpp
+++ b/src/cstore/cstore-varref.cpp
@@ -140,18 +140,21 @@ Cstore::VarRef::process_ref(const Cpath& ref_comps,
return;
}
pcomps.pop();
- def = _cstore->parseTmpl(pcomps, false);
- if (!def.get()) {
- // invalid tmpl path
- return;
- }
- if (def->isTagValue()) {
- // at "tag value", need to pop one more.
- if (pcomps.size() == 0) {
- // invalid path
+ if (pcomps.size() > 0) {
+ // not at root yet
+ def = _cstore->parseTmpl(pcomps, false);
+ if (!def.get()) {
+ // invalid tmpl path
return;
}
- pcomps.pop();
+ if (def->isTagValue()) {
+ // at "tag value", need to pop one more.
+ if (pcomps.size() == 0) {
+ // invalid path
+ return;
+ }
+ pcomps.pop();
+ }
}
process_ref(rcomps, pcomps, ERROR_TYPE);
} else if (cr_comp == "@@") {