diff --git a/roles/easyfix/gather/tasks/main.yml b/roles/easyfix/gather/tasks/main.yml index 506768b497..a14afc6518 100644 --- a/roles/easyfix/gather/tasks/main.yml +++ b/roles/easyfix/gather/tasks/main.yml @@ -53,7 +53,7 @@ - easyfix - name: Install the easyfix script - copy: > + template: > src=gather_easyfix.py dest=/usr/local/bin/gather_easyfix.py owner=root group=root mode=0755 tags: diff --git a/roles/easyfix/gather/templates/easyfix.cron b/roles/easyfix/gather/templates/easyfix.cron new file mode 100644 index 0000000000..941fc17039 --- /dev/null +++ b/roles/easyfix/gather/templates/easyfix.cron @@ -0,0 +1,10 @@ +# Sends the reminder about coming meetings +# +# The frequency set here should be consistent with the one set in the +# configuration file. +# +{% if env == 'staging' %} +*/30 * * * * apache cd /srv/web/easyfix && /usr/bin/python /usr/local/bin/gather_easyfix.py --fedmenu-url="https://apps.stg.fedoraproject.org/fedmenu" --fedmenu-data-url="https://apps.stg.fedoraproject.org/js/data.js" >& /dev/null +{% else %} +*/30 * * * * apache cd /srv/web/easyfix && /usr/bin/python /usr/local/bin/gather_easyfix.py --fedmenu-url="https://apps.fedoraproject.org/fedmenu" --fedmenu-data-url="https://apps.fedoraproject.org/js/data.js" >& /dev/null +{% endif %} diff --git a/roles/easyfix/gather/files/gather_easyfix.py b/roles/easyfix/gather/templates/gather_easyfix.py similarity index 97% rename from roles/easyfix/gather/files/gather_easyfix.py rename to roles/easyfix/gather/templates/gather_easyfix.py index ee53fb5d0a..14bba92e1f 100755 --- a/roles/easyfix/gather/files/gather_easyfix.py +++ b/roles/easyfix/gather/templates/gather_easyfix.py @@ -66,7 +66,11 @@ class MediaWiki(fedora.client.Wiki): https://fedorapeople.org/gitweb?p=till/public_git/cnucnu.git;a=summary """ +{% if env == 'staging' %} + def __init__(self, base_url='https://stg.fedoraproject.org/w/', *args, +{% else %} def __init__(self, base_url='https://fedoraproject.org/w/', *args, +{% endif %} **kwargs): """ Instanciate a Mediawiki client. :arg base_url: base url of the mediawiki to query. @@ -151,7 +155,11 @@ def gather_bugzilla_easyfix(): def gather_project(): """ Retrieve all the projects which have subscribed to this idea. """ +{% if env == 'staging' %} + wiki = MediaWiki(base_url='https://stg.fedoraproject.org/w/') +{% else %} wiki = MediaWiki(base_url='https://fedoraproject.org/w/') +{% endif %} page = wiki.get_pagesource("Easyfix") projects = [] for row in page.split('\n'):