This commit is contained in:
Marc Aymerich 2016-07-15 08:41:38 +00:00
parent 43b6fe1719
commit 6ca38f092b
5 changed files with 13 additions and 7 deletions

View file

@ -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)
)

View file

@ -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,)

View file

@ -37,7 +37,7 @@ ORCHESTRATION_DISABLE_EXECUTION = Setting('ORCHESTRATION_DISABLE_EXECUTION',
ORCHESTRATION_BACKEND_CLEANUP_DAYS = Setting('ORCHESTRATION_BACKEND_CLEANUP_DAYS',
7
20
)

View file

@ -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

View file

@ -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 = {