diff options
author | Michael Larson <slioch@slioch.vyatta.com> | 2010-06-25 13:10:27 -0700 |
---|---|---|
committer | Michael Larson <slioch@slioch.vyatta.com> | 2010-06-25 13:10:27 -0700 |
commit | 92fefe6e3fea41f98593073466dbfc47853cb7b6 (patch) | |
tree | 79fd03f2c242aba249e78ccd713c9bd9fbb6c2d1 /scripts | |
parent | dda7139aa3f37f93726962b0bf35464ceeffc8b5 (diff) | |
download | vyatta-cfg-92fefe6e3fea41f98593073466dbfc47853cb7b6.tar.gz vyatta-cfg-92fefe6e3fea41f98593073466dbfc47853cb7b6.zip |
correct error message when attempting to deactivate a leaf or multi node.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/vyatta-activate-config.pl | 12 |
1 files changed, 11 insertions, 1 deletions
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; } |