diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/VyattaConfig.pm | 14 | ||||
-rwxr-xr-x | scripts/VyattaConfigOutput.pm | 7 |
2 files changed, 20 insertions, 1 deletions
diff --git a/scripts/VyattaConfig.pm b/scripts/VyattaConfig.pm index 1645be6..476d586 100644 --- a/scripts/VyattaConfig.pm +++ b/scripts/VyattaConfig.pm @@ -220,6 +220,20 @@ sub exists { } } +## existsOrig("node") +# Returns true if the "original node" exists. +sub existsOrig { + my ( $self, $node ) = @_; + $node =~ s/\//%2F/g; + $node =~ s/\s+/\//g; + + if ( -d "$self->{_active_dir_base}$self->{_current_dir_level}/$node" ) { + return 1; + } else { + return undef; + } +} + ## isDeleted("node") # is the "node" deleted. node is relative. returns true or false sub isDeleted { diff --git a/scripts/VyattaConfigOutput.pm b/scripts/VyattaConfigOutput.pm index f16007d..56c3a74 100755 --- a/scripts/VyattaConfigOutput.pm +++ b/scripts/VyattaConfigOutput.pm @@ -250,7 +250,12 @@ sub outputNewConfig { if (scalar(keys %rnodes) > 0) { displayChildren(\%rnodes, [ @_ ], ''); } else { - print "Current configuration is empty\n"; + if (defined($config->existsOrig())) { + # this is a deleted node + print 'Configuration under "' . (join ' ', @_) . "\" has been deleted\n"; + } else { + print "Current configuration is empty\n"; + } } } |