From 7874bbb7cfbc500bb98c698a26db0edb69cb8263 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 18 Aug 2020 11:15:53 -0400 Subject: [PATCH 1/2] Travis output improvements --- travis.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis.pl b/travis.pl index 1dfa842..073034e 100644 --- a/travis.pl +++ b/travis.pl @@ -391,7 +391,7 @@ sub mark_time{ print GREEN "\n------Running xcat-inventory CI cases------\n"; $rst = run_inventory_cases(); if($rst){ - print RED "Run inventory cases failed\n"; + print RED "Run xcat-inventory testcases failed\n"; exit $rst; } mark_time("run_inventory_cases"); From 8d967b6922ad9682d6d49447117573f394135113 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 18 Aug 2020 12:07:46 -0400 Subject: [PATCH 2/2] Debugs in backend.py --- xcat-inventory/xcclient/inventory/backend.py | 57 ++++++++++---------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/xcat-inventory/xcclient/inventory/backend.py b/xcat-inventory/xcclient/inventory/backend.py index 2049703..540ee1e 100755 --- a/xcat-inventory/xcclient/inventory/backend.py +++ b/xcat-inventory/xcclient/inventory/backend.py @@ -43,51 +43,54 @@ def loadcfg(self,cfgpath=None): if not os.path.exists(cfgpath): raise InvalidFileException("The configuration file %s does not exist!\n"%(cfgpath)) - config = configparser.ConfigParser() - config.read(cfgpath) + configP = configparser.ConfigParser() + configP.read(cfgpath) #if not config: # raise ParseException("Unable to parse configuration file %s"%(cfgpath)) - if 'backend' not in config.sections(): - raise ParseException("invalid configuration in %s: section \"[%s]\" not found! "%(cfgpath,'backend')) - if 'InfraRepo' not in config.sections(): - raise ParseException("invalid configuration in %s: section \"[%s]\" not found! "%(cfgpath,'InfraRepo')) + if 'backend' not in configP.sections(): + raise ParseException("%s: expected section \"[%s]\" not found! "%(cfgpath,'backend')) + if 'InfraRepo' not in configP.sections(): + raise ParseException("%s: expected section \"[%s]\" not found! "%(cfgpath,'InfraRepo')) - if 'type' in config['backend'].keys(): - self.bkendcfg['type']=utils.stripquotes(config['backend']['type']) + config = dict(configP.items('backend')) + + if 'type' in config.keys(): + self.bkendcfg['type']=utils.stripquotes(config['type']) else: self.bkendcfg['type']='git' - if 'workspace' in config['backend'].keys(): - self.bkendcfg['workspace']=utils.stripquotes(config['backend']['workspace']) + if 'workspace' in config.keys(): + self.bkendcfg['workspace']=utils.stripquotes(config['workspace']) else: self.bkendcfg['workspace']='' - if 'user' in config['backend'].keys(): - self.bkendcfg['user']=utils.stripquotes(config['backend']['user']) + if 'user' in config.keys(): + self.bkendcfg['user']=utils.stripquotes(config['user']) else: self.bkendcfg['user']="xcat" - if 'email' in config['backend'].keys(): - self.bkendcfg['email']=utils.stripquotes(config['backend']['email']) + if 'email' in config.keys(): + self.bkendcfg['email']=utils.stripquotes(config['email']) else: self.bkendcfg['email']="xcat@xcat.org" self.bkendcfg['InfraRepo']={} - if 'InfraRepo' in config.keys(): - if 'remote_repo' in config['InfraRepo'].keys(): - self.bkendcfg['InfraRepo']['remote_repo']=utils.stripquotes(config['InfraRepo']['remote_repo']) - else: - self.bkendcfg['InfraRepo']['remote_repo']="" - if 'local_repo' in config['InfraRepo'].keys(): - self.bkendcfg['InfraRepo']['local_repo']=utils.stripquotes(config['InfraRepo']['local_repo']) - else: - self.bkendcfg['InfraRepo']['local_repo']=utils.gethome() + config = dict(configP.items('InfraRepo')) + if 'remote_repo' in config.keys(): + self.bkendcfg['InfraRepo']['remote_repo']=utils.stripquotes(config['remote_repo']) + else: + self.bkendcfg['InfraRepo']['remote_repo']="" - if 'working_dir' in config['InfraRepo'].keys(): - self.bkendcfg['InfraRepo']['working_dir']=utils.stripquotes(config['InfraRepo']['working_dir']) - else: - self.bkendcfg['InfraRepo']['working_dir']='.' + if 'local_repo' in config.keys(): + self.bkendcfg['InfraRepo']['local_repo']=utils.stripquotes(config['local_repo']) + else: + self.bkendcfg['InfraRepo']['local_repo']=utils.gethome() + + if 'working_dir' in config.keys(): + self.bkendcfg['InfraRepo']['working_dir']=utils.stripquotes(config['working_dir']) + else: + self.bkendcfg['InfraRepo']['working_dir']='.'