diff options
author | Pierre-Yves Chibon <pingou@pingoured.fr> | 2015-04-29 18:07:55 +0200 |
---|---|---|
committer | Pierre-Yves Chibon <pingou@pingoured.fr> | 2015-04-29 18:08:17 +0200 |
commit | 547877d221c217144ff5e2d405af595c5b72064e (patch) | |
tree | e6f9cf257c4ca222b6e4ae8c1a9a4c2337ed31f2 | |
parent | 852110f10028cfa29147c6cec1af8e15244646ec (diff) | |
download | ansible-547877d221c217144ff5e2d405af595c5b72064e.tar.gz ansible-547877d221c217144ff5e2d405af595c5b72064e.tar.xz ansible-547877d221c217144ff5e2d405af595c5b72064e.zip |
Update easyfix to the head of the git repo
-rwxr-xr-x | roles/easyfix/gather/files/gather_easyfix.py | 38 | ||||
-rw-r--r-- | 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 @@ }); </script> + {% if fedmenu_url is defined %} + <script src="{{fedmenu_url}}/js/fedmenu.js"></script> + <script> + fedmenu({ + 'url': '{{fedmenu_data_url}}', + 'mimeType': 'application/javascript', + 'position': 'bottom-right', + }); + </script> + {% endif %} + + <title>Fedora Project easyfix</title> </head> <body id="fedoraproject-org" class="lang-en"> @@ -53,7 +65,7 @@ </div> <div class="grid_1"> <!-- search filler --></div> <div class="grid_6" id="site-heading-rh"> - <a href="http://redhat.com">A Red Hat-Sponsored Community Project + <a href="https://redhat.com">A Red Hat-Sponsored Community Project <img id="rh-community" src="https://fedoraproject.org/static/images/sponsors/redhat-community.png" alt="Red Hat Logo" /></a> </div> @@ -109,7 +121,7 @@ {% for project in projects %} {% if project.tickets %} <div class="main-page-section"> - <h2><a name="{{ project.name }}">{{ project.name }}</a></h2> + <h2><a href="{{ project.url }}" name="{{ project.name }}">{{ project.name }}</a></h2> <p> To get started contact <a href="mailto:{{ project.owner }}@fedoraproject.org"> @@ -132,7 +144,7 @@ <ul> {% for bug in bzbugs | sort %} <li> - <a href="http://bugzilla.redhat.com/{{bug.bug_id}}">#{{bug.bug_id}}</a> + <a href="https://bugzilla.redhat.com/{{bug.bug_id}}">#{{bug.bug_id}}</a> (<a href="https://apps.fedoraproject.org/packages/{{bug.component}}"> {{bug.component}}</a>) - {{bug.short_desc}} <br /> {% if '@' in bug.assigned_to %} @@ -177,7 +189,7 @@ <dd><a href="http://planet.fedoraproject.org/">Planet Fedora</a></dd> <dd><a href="https://fedoraproject.org/wiki/FWN/LatestIssue">Fedora Weekly News</a></dd> - <dd><a href="http://docs.fedoraproject.org/">Documentation</a></dd> + <dd><a href="https://docs.fedoraproject.org/">Documentation</a></dd> <dd><a href="https://fedoraproject.org/wiki/">Fedora Wiki</a></dd> <dd><a href="https://fedoraproject.org/wiki/FedoraEvents">Events</a></dd> </dl> @@ -199,7 +211,7 @@ <dd><a href="https://admin.fedoraproject.org/mailman/listinfo/users">Mailing List Help</a></dd> <dd><a href="http://www.fedoraforum.org/">Forums</a></dd> - <dd><a href="http://docs.fedoraproject.org/">Documentation</a></dd> + <dd><a href="https://docs.fedoraproject.org/">Documentation</a></dd> </dl> </div> <div class="grid_2 sitelinks"> @@ -239,10 +251,10 @@ <div class="clear"></div> <div id="footer" class="grid_12"> - <a href="http://www.redhat.com/"><img class="rh-logo" + <a href="https://www.redhat.com/"><img class="rh-logo" src="https://fedoraproject.org/static/images/sponsors/sidebar/redhat.png" alt="Red Hat Logo" /></a> <p class="sponsor">Fedora is sponsored by Red Hat.</p> - <p class="sponsor"><a href="http://www.redhat.com/rhel/fedora/">Learn more about the relationship between Red Hat and Fedora ></a></p> + <p class="sponsor"><a href="https://www.redhat.com/rhel/fedora/">Learn more about the relationship between Red Hat and Fedora ></a></p> <p class="copy">(C) 2011 Red Hat, Inc. and others.</p> <ul> <li class="first"><a href="/en/contact">Contact</a></li> |