[interchange-cvs] interchange - heins modified lib/Vend/Config.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Thu Apr 10 13:36:01 2003


User:      heins
Date:      2003-04-10 17:35:51 GMT
Modified:  lib/Vend Config.pm
Log:
* Don't leave the bogus Database configuration entry in if the import
  of a configuration database doesn't work.

Revision  Changes    Path
2.110     +9 -7      interchange/lib/Vend/Config.pm


rev 2.110, prev_rev 2.109
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.109
retrieving revision 2.110
diff -u -r2.109 -r2.110
--- Config.pm	7 Apr 2003 12:13:43 -0000	2.109
+++ Config.pm	10 Apr 2003 17:35:51 -0000	2.110
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.109 2003/04/07 12:13:43 mheins Exp $
+# $Id: Config.pm,v 2.110 2003/04/10 17:35:51 mheins Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 # Copyright (C) 2003 ICDEVGROUP <interchange@icdevgroup.org>
@@ -48,7 +48,7 @@
 use Vend::File;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.109 $, 10);
+$VERSION = substr(q$Revision: 2.110 $, 10);
 
 my %CDname;
 my %CPname;
@@ -3304,11 +3304,13 @@
 		config_warn("Bad $var '%s': %s", $table, $err);
 		return '';
 	}
-	$db = Vend::Data::import_database($db);
-	if(! $db) {
-		my $err = $@;
-		config_warn("Bad $var '%s': %s", $table, $err);
-		return '';
+	eval {
+		$db = Vend::Data::import_database($db);
+	};
+	if($@ or ! $db) {
+		my $err = $@ || errmsg("Unable to import table '%s' for config.", $table);
+		delete $C->{Database}{$table};
+		die $err;
 	}
 	return ($db, $table);
 }