From 0494d74dc72f2c40430b8a426fd55a71a4f02bd7 Mon Sep 17 00:00:00 2001
From: Michael Larson <slioch@slioch.vyatta.com>
Date: Thu, 3 Jun 2010 18:14:04 -0700
Subject:     implemented modified notation for pre-commit activate/deactivate.
 added check on modified nodes prior to     load. modified active directory
 check.

---
 lib/Vyatta/Config.pm              |  4 +--
 lib/Vyatta/ConfigOutput.pm        | 62 +++++++++++++++++++++++++++++++++++----
 scripts/vyatta-activate-config.pl |  2 ++
 3 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index 0e71ccf..93a2478 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -594,7 +594,7 @@ sub existsOrig {
       my ($status, undef) = $self->getDeactivated($ttmp);
       #only return value if status is not disabled (i.e. local or both)
       if (defined($status) && ($status eq 'both' || $status eq 'active')) { #if a .disable is in local or active or both then return false
-	  return undef;
+	  return;
       }
   }
 
@@ -678,7 +678,7 @@ sub getDeactivated {
   $node =~ s/ /\//g;
 
   while (1) {
-      my $filepath = "$self->{_changes_only_dir_base}/$node";
+      my $filepath = "$self->{_new_config_dir_base}/$node";
       my $filepathActive = "$self->{_active_dir_base}/$node";
 
       my $local = $filepath . "/.disable";
diff --git a/lib/Vyatta/ConfigOutput.pm b/lib/Vyatta/ConfigOutput.pm
index 0cfb42b..81ee92d 100755
--- a/lib/Vyatta/ConfigOutput.pm
+++ b/lib/Vyatta/ConfigOutput.pm
@@ -85,7 +85,7 @@ sub displayValues {
 
   if ($is_multi) {
     my @ovals = $config->returnOrigValues('','true');
-    my @nvals = $config->returnValues('');
+    my @nvals = $config->returnValues('','true');
     if ($is_text) {
       @ovals = map { (txt_need_quotes($_)) ? "\"$_\"" : "$_"; } @ovals;
       @nvals = map { (txt_need_quotes($_)) ? "\"$_\"" : "$_"; } @nvals;
@@ -209,7 +209,25 @@ sub displayDeletedOrigChildren {
 
 	my ($state, $n) = $config->getDeactivated($path);
 	if (defined $state) {
-	    $dis = '! ';
+	      if ($state eq 'active') {
+		  if (defined($dont_show_as_deleted)) {
+		      $dis = '! ';
+		  }
+		  else {
+		      $dis = 'A ';
+		  }
+	      }
+	      elsif ($state eq 'local') {
+		  if (defined($dont_show_as_deleted)) {
+		      $dis = '  ';
+		  }
+		  else {
+		      $dis = 'D ';
+		  }
+	      }
+	      else {
+		  $dis = '! ';
+	      }
 	}	
 	else {
 	    $dis = '';
@@ -244,7 +262,25 @@ sub displayDeletedOrigChildren {
 	  #need separate check here
 	  my ($state, $n) = $config->getDeactivated($path);
 	  if (defined $state) {
-	      $dis = '! ';
+	      if ($state eq 'active') {
+		  if (defined($dont_show_as_deleted)) {
+		      $dis = '! ';
+		  }
+		  else {
+		      $dis = 'A ';
+		  }
+	      }
+	      elsif ($state eq 'local') {
+		  if (defined($dont_show_as_deleted)) {
+		      $dis = '  ';
+		  }
+		  else {
+		      $dis = 'D ';
+		  }
+	      }
+	      else {
+		  $dis = '! ';
+	      }
 	  }
 	  else {
 	      $dis = '';
@@ -308,7 +344,15 @@ sub displayChildren {
 
 	my ($state, $n) = $config->getDeactivated($path);
 	if (defined $state) {
-	    $dis = '! ';
+	      if ($state eq 'active') {
+		  $dis = 'A ';
+	      }
+	      elsif ($state eq 'local') {
+		  $dis = 'D ';
+	      }
+	      else {
+		  $dis = '! ';
+	      }
 	}	
 	else {
 	    $dis = '';
@@ -350,7 +394,15 @@ sub displayChildren {
 
 	  my ($state, $n) = $config->getDeactivated($path);
 	  if (defined $state) {
-	      $dis = '! ';
+	      if ($state eq 'active') {
+		  $dis = 'A ';
+	      }
+	      elsif ($state eq 'local') {
+		  $dis = 'D ';
+	      }
+	      else {
+		  $dis = '! ';
+	      }
 	  }
 	  else {
 	      $dis = '';
diff --git a/scripts/vyatta-activate-config.pl b/scripts/vyatta-activate-config.pl
index 5d7b7ab..f1269e1 100644
--- a/scripts/vyatta-activate-config.pl
+++ b/scripts/vyatta-activate-config.pl
@@ -143,5 +143,7 @@ else {
     usage();
 }
 
+`touch $ENV{VYATTA_TEMP_CONFIG_DIR}/.modified`;
+
 print "Done\n";
 exit 0;
-- 
cgit v1.2.3