From cf297736b5fd4ff93c3a8188452465bb8d7e80e4 Mon Sep 17 00:00:00 2001 From: Xavier Date: Tue, 14 May 2019 22:05:30 +0200 Subject: [PATCH] Improve cli logs (#1750) --- lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Cli.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Cli.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Cli.pm index 45173a928..e54d00f70 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Cli.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Cli.pm @@ -31,6 +31,8 @@ has yes => ( is => 'rw', isa => 'Bool', default => 0 ); has force => ( is => 'rw', isa => 'Bool', default => 0 ); +has log => ( is => 'rw' ); + sub get { my ( $self, @keys ) = @_; die 'get requires at least one key' unless (@keys); @@ -250,10 +252,10 @@ sub _save { } $new->{cfgAuthor} = 'lmConfigEditor: ' . `whoami`; chomp $new->{cfgAuthor}; - $new->{cfgAuthorIP} = ''; + $new->{cfgAuthorIP} = '127.0.0.1'; $new->{cfgDate} = time; - $new->{cfgVersion} = $VERSION; - $new->{cfgLog} = ''; + $new->{cfgVersion} = $Lemonldap::NG::Manager::VERSION; + $new->{cfgLog} = $self->log || ''; $new->{key} ||= join( '', map { chr( int( ord( Crypt::URandom::urandom(1) ) * 94 / 256 ) + 33 ) } ( 1 .. 16 ) ); @@ -395,6 +397,10 @@ Set it to 1 to save a configuration earlier than latest Confirmation array line format. Default to "%-25s | %-25s | %-25s" +=head3 log() + +String to insert in configuration log field (cfgLog) + =head2 run() The main method: it reads option, command and launch the corresponding