[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r17927: {projects} Fixes bogus cronjob issue and double log message issuing. (k (projects/gettor)
Author: ioerror
Date: 2009-01-05 17:33:00 -0500 (Mon, 05 Jan 2009)
New Revision: 17927
Modified:
projects/gettor/gettor.py
projects/gettor/gettor_log.py
Log:
Fixes bogus cronjob issue and double log message issuing. (kaner)
Modified: projects/gettor/gettor.py
===================================================================
--- projects/gettor/gettor.py 2009-01-05 21:59:17 UTC (rev 17926)
+++ projects/gettor/gettor.py 2009-01-05 22:33:00 UTC (rev 17927)
@@ -80,12 +80,13 @@
# XXX
return True
-def installCron(rsync):
+def installCron():
# XXX: Check if cron is installed and understands our syntax?
currentCronTab = getCurrentCrontab()
- newCronTab = currentCronTab + '\n' + '3 2 * * * ' + rsync
- echoCmd = ['echo', newCronTab ]
- print newCronTab
+ gettorPath = os.getcwd() + "/" + os.path.basename(sys.argv[0])
+ gettorArgs = " --clear-blacklist --fetch-packages --prep-packages"
+ newCronTab = currentCronTab + '\n' + '3 2 * * * ' + gettorPath + gettorArgs
+ echoCmd = ['echo', newCronTab ]
cronCmd = ['crontab', '-']
echoProc = subprocess.Popen(echoCmd, stdout=subprocess.PIPE)
cronProc = subprocess.Popen(cronCmd, stdin=echoProc.stdout)
@@ -207,7 +208,7 @@
log.info(_("Tests passed."))
success = True
if options.installcron:
- if installCron(packs.getCommandToStr()) != 0:
+ if installCron() != 0:
log.error(_("Installing cron failed"))
return False
else:
Modified: projects/gettor/gettor_log.py
===================================================================
--- projects/gettor/gettor_log.py 2009-01-05 21:59:17 UTC (rev 17926)
+++ projects/gettor/gettor_log.py 2009-01-05 22:33:00 UTC (rev 17927)
@@ -32,10 +32,15 @@
format = '%(asctime)-15s (%(process)d) %(message)s'
logger = None
logSubSystem = None
+initialized = False
def initialize():
global logger
global logSubSystem
+ global initialized
+ # Don't add handlers twice
+ if initialized == True:
+ return
config = gettor_config.gettorConf()
logger = logging.getLogger('gettor')
logger.setLevel(loglevel)
@@ -66,6 +71,7 @@
formatter = logging.Formatter(fmt=format)
handler.setFormatter(formatter)
logger.addHandler(handler)
+ initialized = True
def getLogSubSystem():
global logSubSystem