From 547877d221c217144ff5e2d405af595c5b72064e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Wed, 29 Apr 2015 18:07:55 +0200 Subject: Update easyfix to the head of the git repo --- roles/easyfix/gather/files/gather_easyfix.py | 38 ++++++++++++++++++++++------ roles/easyfix/gather/files/template.html | 26 ++++++++++++++----- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/roles/easyfix/gather/files/gather_easyfix.py b/roles/easyfix/gather/files/gather_easyfix.py index eb9eb2dbe..948df806d 100755 --- a/roles/easyfix/gather/files/gather_easyfix.py +++ b/roles/easyfix/gather/files/gather_easyfix.py @@ -26,6 +26,7 @@ The different project to suscribe by email or a git repo or a page on the wiki. To be sorted out... """ +import argparse import datetime import json import logging @@ -61,7 +62,7 @@ class MediaWikiException(Exception): class MediaWiki(fedora.client.Wiki): """ Mediawiki class. Handles interaction with the Mediawiki. - Code stollen from cnucnu: + Code stolen from cnucnu: https://fedorapeople.org/gitweb?p=till/public_git/cnucnu.git;a=summary """ @@ -185,12 +186,28 @@ def get_open_tickets_for_keyword(project, keyword): return tickets +def parse_arguments(): + parser = argparse.ArgumentParser(__doc__) + parser.add_argument( + '--fedmenu-url', help="URL of the fedmenu resources (optional)") + parser.add_argument( + '--fedmenu-data-url', help="URL of the fedmenu data source (optional)") + args = parser.parse_args() + result = {} + for key in ['fedmenu_url', 'fedmenu_data_url']: + if getattr(args, key): + result[key] = getattr(args, key) + return result + + def main(): """ For each projects which have suscribed in the correct place (fedoraproject wiki page), gather all the tickets containing the provided keyword. """ + extra_kwargs = parse_arguments() + template = '/etc/fedora-gather-easyfix/template.html' if not os.path.exists(template): template = './template.html' @@ -209,7 +226,7 @@ def main(): tickets = [] if project.name.startswith('github:'): project.name = project.name.split('github:')[1] - project.url = 'http://github.com/%s/' % (project.name) + project.url = 'https://github.com/%s/' % (project.name) project.site = 'github' url = 'https://api.github.com/repos/%s/issues' \ '?labels=%s&state=open' % (project.name, project.tag) @@ -226,7 +243,7 @@ def main(): ticketobj.status = ticket['state'] tickets.append(ticketobj) else: - project.url = 'http://fedorahosted.org/%s/' % (project.name) + project.url = 'https://fedorahosted.org/%s/' % (project.name) project.site = 'trac' for ticket in get_open_tickets_for_keyword(project.name, project.tag): @@ -234,8 +251,8 @@ def main(): ticketobj = Ticket() ticketobj.id = ticket[0] ticketobj.title = ticket[3]['summary'] - ticketobj.url = 'http://fedorahosted.org/%s/ticket/%s' %( - project.name, ticket[0]) + ticketobj.url = 'https://fedorahosted.org/%s/ticket/%s' %( + project, ticket[0]) ticketobj.status = ticket[3]['status'] ticketobj.type = ticket[3]['type'] ticketobj.component = ticket[3]['component'] @@ -251,9 +268,14 @@ def main(): stream.close() # Fill the template mytemplate = Template(tplfile) - html = mytemplate.render(projects=projects, bzbugs = bzbugs, - ticket_num=ticket_num, bzbugs_num=len(bzbugs), - date=datetime.datetime.now().strftime("%a %b %d %Y %H:%M")) + html = mytemplate.render( + projects=projects, + bzbugs=bzbugs, + ticket_num=ticket_num, + bzbugs_num=len(bzbugs), + date=datetime.datetime.now().strftime("%a %b %d %Y %H:%M"), + **extra_kwargs + ) # Write down the page stream = open('index.html', 'w') stream.write(to_bytes(html)) diff --git a/roles/easyfix/gather/files/template.html b/roles/easyfix/gather/files/template.html index 5114c1f5c..6610f6fd4 100644 --- a/roles/easyfix/gather/files/template.html +++ b/roles/easyfix/gather/files/template.html @@ -36,6 +36,18 @@ }); + {% if fedmenu_url is defined %} + + + {% endif %} + + Fedora Project easyfix @@ -53,7 +65,7 @@
- A Red Hat-Sponsored Community Project + A Red Hat-Sponsored Community Project Red Hat Logo
@@ -109,7 +121,7 @@ {% for project in projects %} {% if project.tickets %}
-

{{ project.name }}

+

{{ project.name }}

To get started contact @@ -132,7 +144,7 @@