mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
use output buffering to avoid too early return
This commit is contained in:
13
plugins.py
13
plugins.py
@@ -888,6 +888,7 @@ def command_dsa_watcher(argv, **args):
|
|||||||
return { 'msg': msg }
|
return { 'msg': msg }
|
||||||
|
|
||||||
if 'crawl' == argv[1]:
|
if 'crawl' == argv[1]:
|
||||||
|
out = []
|
||||||
dsa = conf_load().get('plugin_conf', {}).get('last_dsa', 1000)
|
dsa = conf_load().get('plugin_conf', {}).get('last_dsa', 1000)
|
||||||
|
|
||||||
url = 'https://security-tracker.debian.org/tracker/DSA-%d-1' % dsa
|
url = 'https://security-tracker.debian.org/tracker/DSA-%d-1' % dsa
|
||||||
@@ -897,7 +898,7 @@ def command_dsa_watcher(argv, **args):
|
|||||||
if conf('persistent_locked'):
|
if conf('persistent_locked'):
|
||||||
msg = "couldn't get exclusive lock"
|
msg = "couldn't get exclusive lock"
|
||||||
log.warn(msg)
|
log.warn(msg)
|
||||||
# return { 'msg': msg }
|
out.append(msg)
|
||||||
else:
|
else:
|
||||||
set_conf('persistent_locked', True)
|
set_conf('persistent_locked', True)
|
||||||
blob = conf_load()
|
blob = conf_load()
|
||||||
@@ -915,23 +916,25 @@ def command_dsa_watcher(argv, **args):
|
|||||||
|
|
||||||
msg = 'new Debian Security Announce found: %s' % url
|
msg = 'new Debian Security Announce found: %s' % url
|
||||||
log.plugin(msg)
|
log.plugin(msg)
|
||||||
return { 'msg': msg }
|
out.append(msg)
|
||||||
elif 3 == status:
|
elif 3 == status:
|
||||||
if not '404' in title:
|
if not '404' in title:
|
||||||
msg = 'error for #%s: %s' % (url, title)
|
msg = 'error for #%s: %s' % (url, title)
|
||||||
log.warn(msg)
|
log.warn(msg)
|
||||||
return { 'msg': msg }
|
out.append(msg)
|
||||||
|
|
||||||
|
log.plugin('no dsa for %d, trying again...' % dsa)
|
||||||
# that's good, no error, just 404 -> DSA not released yet
|
# that's good, no error, just 404 -> DSA not released yet
|
||||||
else:
|
else:
|
||||||
log.plugin('unknown status %d' % status)
|
log.plugin('unknown status %d' % status)
|
||||||
|
|
||||||
crawl_at = time.time() + conf('dsa_watcher_interval')
|
crawl_at = time.time() + conf('dsa_watcher_interval')
|
||||||
register_event(crawl_at, command_dsa_watcher, (['dsa-watcher', 'crawl']))
|
register_event(crawl_at, command_dsa_watcher, (['dsa-watcher', 'crawl'],))
|
||||||
|
|
||||||
msg = 'dsa_watcher: next crawl set to %s' % time.strftime('%F.%T', time.localtime(crawl_at))
|
msg = 'dsa_watcher: next crawl set to %s' % time.strftime('%F.%T', time.localtime(crawl_at))
|
||||||
log.plugin(msg)
|
log.plugin(msg)
|
||||||
return { 'msg': msg }
|
out.append(msg)
|
||||||
|
return { 'msg': out }
|
||||||
else:
|
else:
|
||||||
msg = 'wrong argument'
|
msg = 'wrong argument'
|
||||||
log.warn(msg)
|
log.warn(msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user