[vhffs-dev] [2292] robots: fix File::Path::make_path and File::Path:: remove_tree error messages output

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2292
Author:   gradator
Date:     2016-02-06 21:33:24 +0100 (Sat, 06 Feb 2016)
Log Message:
-----------
robots: fix File::Path::make_path and File::Path::remove_tree error messages output

Error variable is an array of hash references. Each hash contains a 
single key/value pair where the key is the name of the file, and the 
value is the error message.

We used to only display the HASH ref (e.g. "HASH(0x29be8e8)"), which is 
pretty useless for an human being. Fix it by displaying only the first 
array entry, this is not perfect, but still better than before, and we 
avoid to to run a for loop over all array entries which might generate a 
very very long log entry.

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm
    trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm
    trunk/vhffs-api/src/Vhffs/Robots/Git.pm
    trunk/vhffs-api/src/Vhffs/Robots/Group.pm
    trunk/vhffs-api/src/Vhffs/Robots/Mail.pm
    trunk/vhffs-api/src/Vhffs/Robots/MailingList.pm
    trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
    trunk/vhffs-api/src/Vhffs/Robots/Repository.pm
    trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
    trunk/vhffs-api/src/Vhffs/Robots/User.pm
    trunk/vhffs-api/src/Vhffs/Robots/Web.pm

Modified: trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -60,7 +60,7 @@
 	if(@$errors) {
 		$bazaar->set_status( Vhffs::Constants::CREATION_ERROR );
 		$bazaar->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating bazaar repository '.$bazaar->get_reponame.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating bazaar repository '.$bazaar->get_reponame.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -112,7 +112,7 @@
 	if(@$errors) {
 		$bazaar->set_status( Vhffs::Constants::DELETION_ERROR );
 		$bazaar->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing bazaar repository '.$bazaar->get_reponame.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing bazaar repository '.$bazaar->get_reponame.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -60,7 +60,7 @@
 	if(@$errors) {
 		$cvs->set_status( Vhffs::Constants::CREATION_ERROR );
 		$cvs->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating cvs repository '.$cvs->get_reponame.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating cvs repository '.$cvs->get_reponame.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -108,7 +108,7 @@
 	if(@$errors) {
 		$cvs->set_status( Vhffs::Constants::DELETION_ERROR );
 		$cvs->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing cvs repository '.$cvs->get_reponame.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing cvs repository '.$cvs->get_reponame.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Git.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/Git.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -62,7 +62,7 @@
 	if(@$errors) {
 		$git->set_status( Vhffs::Constants::CREATION_ERROR );
 		$git->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating git repository '.$git->get_reponame.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating git repository '.$git->get_reponame.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -118,7 +118,7 @@
 	if(@$errors) {
 		$git->set_status( Vhffs::Constants::DELETION_ERROR );
 		$git->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing git repository '.$git->get_reponame.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing git repository '.$git->get_reponame.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Group.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/Group.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -64,7 +64,7 @@
 	if(@$errors) {
 		$group->set_status( Vhffs::Constants::CREATION_ERROR );
 		$group->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating group '.$group->get_groupname.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating group '.$group->get_groupname.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -127,7 +127,7 @@
 	if(@$errors) {
 		$group->set_status( Vhffs::Constants::DELETION_ERROR );
 		$group->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing group '.$group->get_groupname.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing group '.$group->get_groupname.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Mail.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/Mail.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -112,7 +112,7 @@
 	if(@$errors) {
 		$mail->set_status( Vhffs::Constants::DELETION_ERROR );
 		$mail->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing mail domain '.$mail->get_domain.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing mail domain '.$mail->get_domain.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -153,7 +153,7 @@
 	if( @$errors ) {
 		$box->set_status( Vhffs::Constants::CREATION_ERROR );
 		$box->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating mail box '.$box->get_localpart->get_localpart.'@'.$mail->get_domain.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating mail box '.$box->get_localpart->get_localpart.'@'.$mail->get_domain.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -185,7 +185,7 @@
 	if( @$errors ) {
 		$box->set_status( Vhffs::Constants::DELETION_ERROR );
 		$box->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while deleting mail box '.$box->get_localpart->get_localpart.'@'.$mail->get_domain.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while deleting mail box '.$box->get_localpart->get_localpart.'@'.$mail->get_domain.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/MailingList.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/MailingList.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -103,7 +103,7 @@
 
 	File::Path::make_path( $publicdir, { mode => 0755, error => \my $errors } );
 	if(@$errors) {
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating mailing list archives '.$publicdir.' directory: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating mailing list archives '.$publicdir.' directory: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -60,7 +60,7 @@
 	if(@$errors) {
 		$mercurial->set_status( Vhffs::Constants::CREATION_ERROR );
 		$mercurial->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating mercurial repository '.$mercurial->get_reponame.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating mercurial repository '.$mercurial->get_reponame.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -112,7 +112,7 @@
 	if(@$errors) {
 		$mercurial->set_status( Vhffs::Constants::DELETION_ERROR );
 		$mercurial->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing mercurial repository '.$mercurial->get_reponame.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing mercurial repository '.$mercurial->get_reponame.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/Repository.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Repository.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/Repository.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -61,7 +61,7 @@
 	if(@$errors) {
 		$repository->set_status( Vhffs::Constants::CREATION_ERROR );
 		$repository->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating downloads repository '.$repository->get_name.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating downloads repository '.$repository->get_name.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -102,7 +102,7 @@
 	if(@$errors) {
 		$repository->set_status( Vhffs::Constants::DELETION_ERROR );
 		$repository->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing downloads repository '.$repository->get_name.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing downloads repository '.$repository->get_name.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Svn.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/Svn.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -60,7 +60,7 @@
 	if(@$errors) {
 		$svn->set_status( Vhffs::Constants::CREATION_ERROR );
 		$svn->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating svn repository '.$svn->get_reponame.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating svn repository '.$svn->get_reponame.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -112,7 +112,7 @@
 	if(@$errors) {
 		$svn->set_status( Vhffs::Constants::DELETION_ERROR );
 		$svn->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing svn repository '.$svn->get_reponame.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing svn repository '.$svn->get_reponame.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/User.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/User.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -64,7 +64,7 @@
 	if(@$errors) {
 		$user->set_status( Vhffs::Constants::CREATION_ERROR );
 		$user->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating home dir for user '.$user->get_username.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating home dir for user '.$user->get_username.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -118,7 +118,7 @@
 	if(@$errors) {
 		$user->set_status( Vhffs::Constants::DELETION_ERROR );
 		$user->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing home dir for user '.$user->get_username.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing home dir for user '.$user->get_username.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Web.pm	2015-11-29 21:28:48 UTC (rev 2291)
+++ trunk/vhffs-api/src/Vhffs/Robots/Web.pm	2016-02-06 20:33:24 UTC (rev 2292)
@@ -62,7 +62,7 @@
 	if(@$errors) {
 		$web->set_status( Vhffs::Constants::CREATION_ERROR );
 		$web->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating web area '.$web->get_servername.' to the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating web area '.$web->get_servername.' to the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 
@@ -111,7 +111,7 @@
 	if(@$errors) {
 		$web->set_status( Vhffs::Constants::DELETION_ERROR );
 		$web->commit;
-		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing web area '.$web->get_servername.' from the filesystem: '.join(', ', @$errors) );
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing web area '.$web->get_servername.' from the filesystem: '.join(': ', %{@$errors[0]}) );
 		return undef;
 	}
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/