lower case in config file

This commit is contained in:
2013-01-13 21:32:33 +00:00
parent 748fef4403
commit ddb521d9cc
2 changed files with 17 additions and 16 deletions

View File

@@ -67,19 +67,19 @@ def workdir(directory):
debug.debug("===============================", 1)
# skip directory if no CONFIGFILE present
if not os.path.isfile(directory+"/"+cfg.get("Main", "CONFIGFILE")):
debug.debug("No %s in %s, skipping." % (cfg.get("Main", "CONFIGFILE"), directory), 1)
if not os.path.isfile(directory+"/"+cfg.get("Main", "configfile")):
debug.debug("No %s in %s, skipping." % (cfg.get("Main", "configfile"), directory), 1)
return ({},None)
# if not DEST
# get config file for directory
dirConfig = Tools.getConfig(directory+"/"+cfg.get("Main", "CONFIGFILE"))
dirConfig = Tools.getConfig(directory+"/"+cfg.get("Main", "configfile"))
if not dirConfig:
debug.debug("Cannot read %s in %s, skipping." % (cfg.get("Main", "CONFIGFILE"), directory), 1)
debug.debug("Cannot read %s in %s, skipping." % (cfg.get("Main", "configfile"), directory), 1)
return ({},None)
# if not dirConfig
destdir = dirConfig.get("Main","DEST")
destdir = dirConfig.get("Main","dest")
# destfiles is a dict of all files that will be created from the classes config
# key is the destination filename, values are all classes filenames that are used to
# build the file
@@ -121,7 +121,7 @@ def buildFile(classfiles, destfile, commentstring):
returns the name of tempfile"""
content = []
if commentstring != "":
content.append(commentstring + " " + cfg.get("Main","STAMP") + " " + time.strftime("%+") + "\n")
content.append(commentstring + " " + cfg.get("Main","stamp") + " " + time.strftime("%+") + "\n")
# if commentstring not empty
for f in classfiles:
@@ -130,8 +130,8 @@ def buildFile(classfiles, destfile, commentstring):
fp.close()
if commentstring == "":
# look for stamp in content, replace with real stamp
if re.search(re.escape(cfg.get("Main","STAMPREPLACE")), filecontent):
filecontent = re.sub(re.escape(cfg.get("Main","STAMPREPLACE")), cfg.get("Main","STAMP"), filecontent)
if re.search(re.escape(cfg.get("Main","stampreplace")), filecontent):
filecontent = re.sub(re.escape(cfg.get("Main","stampreplace")), cfg.get("Main","stamp"), filecontent)
# if search
# if commentstring empty
content.append(filecontent)
@@ -227,7 +227,7 @@ def main():
cfg.setfilename(configfile)
debug.debug("Classes for host: %s" % hostclasses)
configdir = cfg.get("Main", "CONFIGDIR")
configdir = cfg.get("Main", "configdir")
for d in os.listdir(configdir):
destfiles = {}
name = configdir+d