Download:
child 237:6098f4b17b2f
parent 235:5c6577eccbc5
236:3f5b52fcf6e1
Anton Shestakov <av6@dwimlabs.net>, Wed, 31 Aug 2016 12:55:48 +0800
queue: infer source from the url if it's not in target config

1 файлов изменено, 9 вставок(+), 0 удалений(-) [+]
poll-hgweb-queue.py file | annotate | diff | comparison | revisions
--- a/poll-hgweb-queue.py Wed Aug 31 12:25:36 2016 +0800
+++ b/poll-hgweb-queue.py Wed Aug 31 12:55:48 2016 +0800
@@ -2,6 +2,7 @@
import json
import logging
from argparse import ArgumentParser, FileType, SUPPRESS
+from urlparse import urlparse
import redis
import yaml
@@ -13,6 +14,12 @@
from candolint.utils import lookup_option, timestamp
+def fill_blanks(target):
+ parsed = urlparse(target['url'])
+ if 'source' not in target:
+ target['source'] = parsed.hostname
+
+
class CandolintPoller(Application):
def __init__(self, rconn, targets, interval, debug):
handlers = []
@@ -25,6 +32,8 @@
@coroutine
def setup(self):
for target in self.targets:
+ fill_blanks(target)
+
yield self.poll(target)
@coroutine