summaryrefslogtreecommitdiff
path: root/scripts/VyattaConfig.pm
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-12-20 17:35:21 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2007-12-20 17:35:21 -0800
commit67aa6f38631f725e90dce71fb1ed59cb8ed7ac63 (patch)
tree0f94dccc69e4c4a6b9acfdaa2a2b494eb7eac689 /scripts/VyattaConfig.pm
parentaac164fc48911b10e09b8d562e21aef90bad9699 (diff)
downloadvyatta-cfg-67aa6f38631f725e90dce71fb1ed59cb8ed7ac63.tar.gz
vyatta-cfg-67aa6f38631f725e90dce71fb1ed59cb8ed7ac63.zip
Added method 'isChangedOrDeleted'. Part of Bug 2324 fix.
Diffstat (limited to 'scripts/VyattaConfig.pm')
-rw-r--r--scripts/VyattaConfig.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/VyattaConfig.pm b/scripts/VyattaConfig.pm
index 3a24579..6c37073 100644
--- a/scripts/VyattaConfig.pm
+++ b/scripts/VyattaConfig.pm
@@ -283,6 +283,32 @@ sub isChanged {
else { return 0; }
}
+## isChangedOrDeleted("node")
+# is the "node" changed or deleted. node is relative. returns true or false
+sub isChangedOrDeleted {
+ my ($self, $node) = @_;
+
+ $node =~ s/\//%2F/g;
+ $node =~ s/\s+/\//g;
+
+ my $filepathChg
+ = "$self->{_changes_only_dir_base}$self->{_current_dir_level}/$node";
+ if (-e $filepathChg) {
+ return 1;
+ }
+
+ my $filepathAct
+ = "$self->{_active_dir_base}$self->{_current_dir_level}/$node";
+ my $filepathNew
+ = "$self->{_new_config_dir_base}$self->{_current_dir_level}/$node";
+
+ if ((-e $filepathAct) && !(-e $filepathNew)) {
+ return 1;
+ }
+
+ return 0;
+}
+
## isAdded("node")
# will compare the new_config_dir to the active_dir to see if the "node" has
# been added. returns true or false.