summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Config.pm
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-05-04 17:54:56 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-05-04 17:54:56 -0700
commit0ffdc5e6d89f9677694a8eef916b07c089264753 (patch)
tree08f9693bdad87301ebb1306de73d77888df84413 /lib/Vyatta/Config.pm
parent576e0fed6b0e32bb92915a10f95677303eda478a (diff)
downloadvyatta-cfg-0ffdc5e6d89f9677694a8eef916b07c089264753.tar.gz
vyatta-cfg-0ffdc5e6d89f9677694a8eef916b07c089264753.zip
initial working version of activate and deactivate: load,save,show,commit supported.
Diffstat (limited to 'lib/Vyatta/Config.pm')
-rwxr-xr-xlib/Vyatta/Config.pm42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index 4ede95e..8de3aba 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -525,6 +525,48 @@ sub listDeleted {
return @deleted;
}
+## isDeactivated("node")
+# returns back whether this node is in an active (false) or
+# deactivated (true) state.
+sub getDeactivated {
+ my ($self, $node) = @_;
+
+ if (!defined $node) {
+ }
+
+ # let's setup the filepath for the change_dir
+ $node =~ s/\//%2F/g;
+ $node =~ s/\s+/\//g;
+ #now walk up parent in local and in active looking for '.disable' file
+
+ my @a = split(" ",$node);
+ $node = join("/",@a);
+
+ while (1) {
+ my $filepath = "$self->{_changes_only_dir_base}/$node";
+ my $filepathActive = "$self->{_active_dir_base}/$node";
+
+ my $local = $filepath . "/.disable";
+ my $active = $filepathActive . "/.disable";
+
+ if (-e $local && -e $active) {
+ return ("both",$node);
+ }
+ elsif (-e $local && !(-e $active)) {
+ return ("local",$node);
+ }
+ elsif (!(-e $local) && -e $active) {
+ return ("active",$node);
+ }
+ my $pos = rindex($node, "/");
+ if ($pos == -1) {
+ last;
+ }
+ $node = substr($node,0,$pos);
+ }
+ return (undef,undef);
+}
+
## isChanged("node")
# will check the change_dir to see if the "node" has been changed from a previous
# value. returns true or false.