Skip to content

Commit

Permalink
Merge pull request #227 from xcat2/travis-enhance
Browse files Browse the repository at this point in the history
Travis output improvements
  • Loading branch information
besawn authored Aug 19, 2020
2 parents a04e474 + 8d967b6 commit aeb2e3e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion travis.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
57 changes: 30 additions & 27 deletions xcat-inventory/xcclient/inventory/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']="[email protected]"

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']='.'



Expand Down

0 comments on commit aeb2e3e

Please sign in to comment.