summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-07-30 09:53:00 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2010-07-30 09:53:00 -0700
commitdc4bd2c05375cece9d1c1281cbebbef40a09c4e4 (patch)
tree1ad940cb817d22726b1e1f763f12b0e11f3a5acc /lib
parent56dc9db80960f62f021958baba29c49dda895b03 (diff)
downloadvyatta-cfg-dc4bd2c05375cece9d1c1281cbebbef40a09c4e4.tar.gz
vyatta-cfg-dc4bd2c05375cece9d1c1281cbebbef40a09c4e4.zip
add default status observers
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/Config.pm23
-rwxr-xr-xlib/Vyatta/ConfigLoad.pm4
2 files changed, 23 insertions, 4 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index 8067e05..371fe32 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -53,8 +53,9 @@ sub get_path_comps {
}
############################################################
-# low-level API functions that have been converted to use
-# the cstore library.
+# low-level API functions that use the cstore library directly.
+# they are either new functions or old ones that have been
+# converted to use cstore.
############################################################
######
@@ -94,6 +95,24 @@ sub existsOrig {
return; # note: this return is needed.
}
+## isDefault("path to node")
+# Returns true if specified node is "default" in working config.
+sub isDefault {
+ my ($self, $path) = @_;
+ return 1
+ if ($self->{_cstore}->cfgPathDefault($self->get_path_comps($path), undef));
+ return; # note: this return is needed.
+}
+
+## isDefaultOrig("path to node")
+# Returns true if specified node is "default" in active config.
+sub isDefaultOrig {
+ my ($self, $path) = @_;
+ return 1
+ if ($self->{_cstore}->cfgPathDefault($self->get_path_comps($path), 1));
+ return; # note: this return is needed.
+}
+
## listNodes("level")
# return array of all child nodes at "level" in working config.
sub listNodes {
diff --git a/lib/Vyatta/ConfigLoad.pm b/lib/Vyatta/ConfigLoad.pm
index d3d7dbb..55ba76b 100755
--- a/lib/Vyatta/ConfigLoad.pm
+++ b/lib/Vyatta/ConfigLoad.pm
@@ -401,8 +401,8 @@ sub getConfigDiff {
$file;
} @{${$del}[0]};
- my ($is_multi, $is_text, $default)
- = $active_cfg->parseTmpl(join ' ', @comps);
+ $active_cfg->setLevel(join ' ', @comps);
+ my ($is_multi, $is_text, $default) = $active_cfg->parseTmpl();
if (!defined($default)) {
push @new_delete_list, $del;
}