[X2Go-Commits] [x2goserver] 01/04: revert to using Try::Tiny due to heavy dependencies in various older distributions

git-admin at x2go.org git-admin at x2go.org
Tue Jun 17 21:08:22 CEST 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit 3d9aaf13275ae37240802bd51378baa9cd2c5d1a
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Jun 17 21:05:41 2014 +0200

    revert to using Try::Tiny due to heavy dependencies in various older distributions
---
 x2goserver/sbin/x2godbadmin |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/x2goserver/sbin/x2godbadmin b/x2goserver/sbin/x2godbadmin
index f0053af..437ed8a 100755
--- a/x2goserver/sbin/x2godbadmin
+++ b/x2goserver/sbin/x2godbadmin
@@ -25,7 +25,7 @@ use Sys::Syslog qw( :standard :macros );
 use File::Path qw( make_path );
 use Getopt::Long;
 use DBI;
-use TryCatch;
+use Try::Tiny;
 
 use X2Go::Config qw( get_sqlconfig );
 use X2Go::Log qw( loglevel );
@@ -266,12 +266,14 @@ if ($updatedb)
 {
 	# check if the DB already exists, if not, create it...
 	my $dbh;
-	try {
-		$dbh = DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass",{AutoCommit => 1, RaiseError => 1, PrintError => 0});
-	} catch {
+	until (
+		$dbh = DBI->connect("dbi:Pg:dbname='test';host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass",{AutoCommit => 1, RaiseError => 0, PrintError => 0})
+	) {
 		$createdb = 1;
+		last;
 	};
 	if (!$createdb) {
+		$dbh = DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass",{AutoCommit => 1});
 		if ($dbh) {
 			my $sth_tekictrl;
 			my $sth_tekidata;
@@ -288,7 +290,7 @@ if ($updatedb)
 				                  ");
 				$sth_tekictrl->execute() or die;
 				$sth_tekictrl->finish();
-			}
+			};
 			try {
 				$sth_tekidata = $dbh->prepare("
 				              select tekidata_port from sessions
@@ -302,7 +304,7 @@ if ($updatedb)
 				                  ");
 				$sth_tekidata->execute() or die;
 				$sth_tekidata->finish();
-			}
+			};
 		}
 		if ($dbh) {
 			$dbh->disconnect();

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list