From 6ca38f092b91cbb6dca9681dc06a46c123052eec Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Fri, 15 Jul 2016 08:41:38 +0000 Subject: [PATCH] Update --- orchestra/contrib/lists/backends.py | 3 ++- orchestra/contrib/orchestration/admin.py | 2 +- orchestra/contrib/orchestration/settings.py | 2 +- orchestra/contrib/resources/aggregations.py | 8 +++++--- orchestra/contrib/saas/backends/wordpressmu.py | 5 ++++- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/orchestra/contrib/lists/backends.py b/orchestra/contrib/lists/backends.py index b8cf7e98..983bc39f 100644 --- a/orchestra/contrib/lists/backends.py +++ b/orchestra/contrib/lists/backends.py @@ -272,7 +272,7 @@ class MailmanTraffic(ServiceMonitor): 'Nov': '11', 'Dec': '12', }} - mailman_addr = re.compile(r'.*-(admin|bounces|confirm|join|leave|owner|request|subscribe|unsubscribe)@.*') + mailman_addr = re.compile(r'.*-(admin|bounces|confirm|join|leave|owner|request|subscribe|unsubscribe)@.*|mailman@.*') def prepare(object_id, list_name, ini_date): global lists @@ -315,6 +315,7 @@ class MailmanTraffic(ServiceMonitor): ps = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) subscribers = ps.communicate()[0].strip() size *= int(subscribers) + sys.stderr.write("%s %s*%s traffic*subscribers\\n" % (object_id, size, subscribers)) print object_id, size """).format(**context) ) diff --git a/orchestra/contrib/orchestration/admin.py b/orchestra/contrib/orchestration/admin.py index 80ff6213..1a81a6d9 100644 --- a/orchestra/contrib/orchestration/admin.py +++ b/orchestra/contrib/orchestration/admin.py @@ -135,7 +135,7 @@ class BackendLogAdmin(ChangeViewActionsMixin, admin.ModelAdmin): 'display_created', 'execution_time', ) list_display_links = ('id', 'backend') - list_filter = ('state', 'server', 'backend') + list_filter = ('state', 'server', 'backend', 'operations__action') search_fields = ('script',) date_hierarchy = 'created_at' inlines = (BackendOperationInline,) diff --git a/orchestra/contrib/orchestration/settings.py b/orchestra/contrib/orchestration/settings.py index b115ce48..d74c5314 100644 --- a/orchestra/contrib/orchestration/settings.py +++ b/orchestra/contrib/orchestration/settings.py @@ -37,7 +37,7 @@ ORCHESTRATION_DISABLE_EXECUTION = Setting('ORCHESTRATION_DISABLE_EXECUTION', ORCHESTRATION_BACKEND_CLEANUP_DAYS = Setting('ORCHESTRATION_BACKEND_CLEANUP_DAYS', - 7 + 20 ) diff --git a/orchestra/contrib/resources/aggregations.py b/orchestra/contrib/resources/aggregations.py index 6b2f6f39..13d966cc 100644 --- a/orchestra/contrib/resources/aggregations.py +++ b/orchestra/contrib/resources/aggregations.py @@ -45,17 +45,19 @@ class Last(Aggregation): def aggregate_history(self, dataset): prev_object_id = None + prev_object_repr = None for mdata in dataset.order_by('object_id', 'created_at'): object_id = mdata.object_id if object_id != prev_object_id: if prev_object_id is not None: - yield (mdata.content_object_repr, datas) + yield (prev_object_repr, datas) datas = [mdata] else: datas.append(mdata) prev_object_id = object_id + prev_object_repr = mdata.content_object_repr if prev_object_id is not None: - yield (mdata.content_object_repr, datas) + yield (prev_object_repr, datas) class MonthlySum(Last): @@ -98,7 +100,7 @@ class MonthlySum(Last): current += mdata.value if object_id != prev_object_id: if prev_object_id is not None: - yield(prev.content_object_repr, datas) + yield (prev.content_object_repr, datas) datas = [] prev = mdata prev.ymonth = ymonth diff --git a/orchestra/contrib/saas/backends/wordpressmu.py b/orchestra/contrib/saas/backends/wordpressmu.py index d6a3ef78..c659c073 100644 --- a/orchestra/contrib/saas/backends/wordpressmu.py +++ b/orchestra/contrib/saas/backends/wordpressmu.py @@ -87,7 +87,10 @@ class WordpressMuController(ServiceController): content = session.get(url, verify=self.VERIFY).content.decode('utf8') wpnonce = re.compile('name="_wpnonce_add-blog"\s+value="([^"]*)"') - wpnonce = wpnonce.search(content).groups()[0] + try: + wpnonce = wpnonce.search(content).groups()[0] + except AttributeError: + raise RuntimeError("wpnonce not foud in %s" % content) url += '?action=add-site' data = {