From 92fefe6e3fea41f98593073466dbfc47853cb7b6 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Fri, 25 Jun 2010 13:10:27 -0700 Subject: correct error message when attempting to deactivate a leaf or multi node. --- scripts/vyatta-activate-config.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vyatta-activate-config.pl b/scripts/vyatta-activate-config.pl index 6226f81..87791f3 100644 --- a/scripts/vyatta-activate-config.pl +++ b/scripts/vyatta-activate-config.pl @@ -71,7 +71,10 @@ if (!defined $ARGV[1] || $ARGV[1] eq '') { #adjust for leaf node my $i = 0; -my @path = @ARGV[1..$#ARGV]; +my $arg_ct = $#ARGV; +my @path = @ARGV[1..$arg_ct]; +my @parent_path = @ARGV[1..($arg_ct-1)]; + foreach my $elem (@path) { $elem =~ s/\//%2F/g; $elem =~ s/\s+/\//g; @@ -90,6 +93,13 @@ if (-e $full_path) { } } else { + #check if this is a leaf node with value + my $parent_path_leaf = $ENV{VYATTA_TEMP_CONFIG_DIR} . "/" . join('/', @parent_path) . "/node.val"; + if (-e $parent_path_leaf) { + #prevent setting on leaf or multi, check for node.val + printf("Cannot deactivate end node\n"); + exit 1; + } printf("This configuration element does not exist: " . join(' ', @path) . "\n"); exit 1; } -- cgit v1.2.3