From: Tony Mack Date: Wed, 18 Jul 2012 02:42:19 +0000 (-0400) Subject: fix read_config() X-Git-Tag: sfa-2.1-14~101 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=d07712ab8b6f9a4a88a3728ec7809796d27e4952;p=sfa.git fix read_config() --- diff --git a/sfa/client/sfi.py b/sfa/client/sfi.py index 28c7c1ad..792c404f 100644 --- a/sfa/client/sfi.py +++ b/sfa/client/sfi.py @@ -549,19 +549,21 @@ class Sfi: def read_config(self): config_file = os.path.join(self.options.sfi_dir,"sfi_config") try: - config = Config (config_file) + if Config.is_ini(config_file): + config = Config (config_file) + else: + # try upgrading from shell config format + self.upgrade_config(config_file) + config = Config(config_file) + except: - try: - # try upgrading from old config format - self.upgrade_config(config_file) - except: - self.logger.critical("Failed to read configuration file %s"%config_file) - self.logger.info("Make sure to remove the export clauses and to add quotes") - if self.options.verbose==0: - self.logger.info("Re-run with -v for more details") - else: - self.logger.log_exc("Could not read config file %s"%config_file) - sys.exit(1) + self.logger.critical("Failed to read configuration file %s"%config_file) + self.logger.info("Make sure to remove the export clauses and to add quotes") + if self.options.verbose==0: + self.logger.info("Re-run with -v for more details") + else: + self.logger.log_exc("Could not read config file %s"%config_file) + sys.exit(1) errors = 0 # Set SliceMgr URL