diff options
author | 2009-10-03 10:35:26 +0530 | |
---|---|---|
committer | 2009-10-03 10:35:26 +0530 | |
commit | 06afbd2836514c53a683726e1dc4e318c3a32edb (patch) | |
tree | 5fef06fde655fb53b44ef2f39a33022bb730bd81 | |
parent | Fix the URL we send to PortageCheck (diff) | |
download | gard-06afbd2836514c53a683726e1dc4e318c3a32edb.tar.gz gard-06afbd2836514c53a683726e1dc4e318c3a32edb.tar.bz2 gard-06afbd2836514c53a683726e1dc4e318c3a32edb.zip |
Handle the '/' character in URLs while logging
The log path was <some_prefix>/<URL>. If URL had a '/', logging broke.
This replaces '/' with '-' in URL while setting up logging.
-rwxr-xr-x | gard-v2.py | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -25,7 +25,7 @@ HOME = os.getenv('HOME') reportpath = HOME + "/gentoo/mirrors/gard/reports" bugurl = "http://bugs.gentoo.org/buglist.cgi?query_format=advanced&product=Mirrors&status_whiteboard_type=allwordssubstr&status_whiteboard=due&bug_status=ASSIGNED&columnlist=bug_id,opendate,bug_status,resolution,short_desc,status_whiteboard&ctype=csv" -def start_logging(logfile, bugnum, proto): +def start_logging(url, bugnum, proto): logger = logging.getLogger() logger.setLevel(logging.INFO) @@ -37,7 +37,7 @@ def start_logging(logfile, bugnum, proto): console.setFormatter(formatter) logger.addHandler(console) - file = logging.FileHandler(logfile) + file = logging.FileHandler(reportpath + url.replace('/', '-')) file.setFormatter(formatter) logger.addHandler(file) @@ -91,13 +91,12 @@ for line in file: addy=grsync #hdomain='/'+addy[2] if len(grsync) > 0: - fname=reportpath+"/"+grsync if os.path.isdir(reportpath): pass else: os.makedirs(reportpath) - handlers = start_logging(fname, bugnum, 'rsync') + handlers = start_logging(addy, bugnum, 'rsync') info4=grsync+" wants to be a gentoo-portage mirror and is being checked as per Bug #"+bugnum logging.info(info4) @@ -115,12 +114,11 @@ for line in file: logging.info('') stop_logging(handlers) if len(http) > 0: - fname=reportpath+"/"+addy if os.path.isdir(reportpath): pass else: os.makedirs(reportpath) - handlers = start_logging(fname, bugnum, 'http ') + handlers = start_logging(addy, bugnum, 'http ') info5 = addy+" wants to be source mirror and is being checked as per Bug #"+bugnum+ " over http" logging.info(info5) @@ -141,13 +139,12 @@ for line in file: logging.info('') stop_logging(handlers) if len(ftp) > 0: - fname=reportpath+"/"+addy if os.path.isdir(reportpath): pass else: os.makedirs(reportpath) - handlers = start_logging(fname, bugnum, 'ftp ') + handlers = start_logging(addy, bugnum, 'ftp ') info6 = addy+" wants to be a source mirror and is being checked as per Bug #"+bugnum+ " over ftp" logging.info(info6) @@ -171,13 +168,12 @@ for line in file: if len(drsync) > 0: # Replace with check.DistfilesCheck(drsyync).check() # after testing - fname=reportpath+"/"+addy if os.path.isdir(reportpath): pass else: os.makedirs(reportpath) - handlers = start_logging(fname, bugnum, 'rsync') + handlers = start_logging(addy, bugnum, 'rsync') info7 = addy+" wants to be a source mirror and is being checked as per Bug #"+bugnum+ " over rsync" logging.info(info7) |