diff options
author | Michael Larson <slioch@slioch.vyatta.com> | 2010-05-14 13:47:21 -0700 |
---|---|---|
committer | Michael Larson <slioch@slioch.vyatta.com> | 2010-05-14 13:47:21 -0700 |
commit | d36d0a6ea76d443c5e4072401eaa9dbf563c74bd (patch) | |
tree | 9daed3e19d3d5b8231a9894891ac00d4df9b9c3a /lib/Vyatta/Config.pm | |
parent | 91bb77e328c9cad994609aeeccb33971eca1486f (diff) | |
download | vyatta-cfg-d36d0a6ea76d443c5e4072401eaa9dbf563c74bd.tar.gz vyatta-cfg-d36d0a6ea76d443c5e4072401eaa9dbf563c74bd.zip |
initial checkin of comment feature for cli.
/* to create a comment */
> comment [PATH-TO-NODE] "my comments"
/* to delete a comment */
> comment [PATH-TO-NODE] ""
Diffstat (limited to 'lib/Vyatta/Config.pm')
-rwxr-xr-x | lib/Vyatta/Config.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm index 82d835f..c0c8494 100755 --- a/lib/Vyatta/Config.pm +++ b/lib/Vyatta/Config.pm @@ -329,6 +329,27 @@ sub returnValue { return $tmp; } +## returnComment("node") +# returns the value of "node" or undef if the node doesn't exist . +# node is relative +sub returnComment { + my ( $self, $node ) = @_; + my $tmp = undef; + + $node =~ s/\//%2F/g; + $node =~ s/\s+/\//g; + + return unless + open my $file, '<', + "$self->{_new_config_dir_base}/$node/.comment"; + + read $file, $tmp, 16384; + close $file; + + $tmp =~ s/\n$//; + return $tmp; +} + ## returnOrigPlusComValue("node") # returns the value of "node" or undef if the node doesn't exist . # node is relative |