| |
@@ -1,7 +1,7 @@
|
| |
#!/usr/bin/python -tt
|
| |
# -*- coding: utf-8 -*-
|
| |
#
|
| |
- # Copyright © 2013-2017 Red Hat, Inc.
|
| |
+ # Copyright © 2013-2019 Red Hat, Inc.
|
| |
#
|
| |
# This copyrighted material is made available to anyone wishing to use, modify,
|
| |
# copy, or redistribute it subject to the terms and conditions of the GNU
|
| |
@@ -60,6 +60,8 @@
|
| |
from requests.packages.urllib3.util.retry import Retry
|
| |
|
| |
|
| |
+ env = 'staging'
|
| |
+
|
| |
cache = dogpile.cache.make_region().configure(
|
| |
'dogpile.cache.memory',
|
| |
expiration_time=3600,
|
| |
@@ -81,11 +83,10 @@
|
| |
return session
|
| |
|
| |
|
| |
- {% if env == 'staging' %}
|
| |
- BZSERVER = 'https://partner-bugzilla.redhat.com'
|
| |
- {% else %}
|
| |
- BZSERVER = 'https://bugzilla.redhat.com'
|
| |
- {% endif %}
|
| |
+ if env == 'staging':
|
| |
+ BZSERVER = 'https://partner-bugzilla.redhat.com'
|
| |
+ else:
|
| |
+ BZSERVER = 'https://bugzilla.redhat.com'
|
| |
|
| |
BZUSER = '{{ bugzilla_user }}'
|
| |
BZPASS = '{{ bugzilla_password }}'
|
| |
@@ -100,21 +101,20 @@
|
| |
VERBOSE = False
|
| |
DRYRUN = False
|
| |
|
| |
- {% if env == 'staging' %}
|
| |
- FASURL = 'https://admin.stg.fedoraproject.org/accounts'
|
| |
- FASINSECURE = True
|
| |
- PAGUREURL = 'https://stg.pagure.io'
|
| |
- PAGURE_DIST_GIT_URL = 'https://src.stg.fedoraproject.org'
|
| |
- PDCURL = 'https://pdc.stg.fedoraproject.org/rest_api/v1/'
|
| |
- MDAPIURL = 'https://apps.stg.fedoraproject.org/mdapi/'
|
| |
- {% else %}
|
| |
- FASURL = 'https://admin.fedoraproject.org/accounts'
|
| |
- FASINSECURE = False
|
| |
- PAGUREURL = 'https://pagure.io'
|
| |
- PAGURE_DIST_GIT_URL = 'https://src.fedoraproject.org'
|
| |
- PDCURL = 'https://pdc.fedoraproject.org/rest_api/v1/'
|
| |
- MDAPIURL = 'https://apps.fedoraproject.org/mdapi/'
|
| |
- {% endif %}
|
| |
+ if env == 'staging':
|
| |
+ FASURL = 'https://admin.stg.fedoraproject.org/accounts'
|
| |
+ FASINSECURE = True
|
| |
+ PAGUREURL = 'https://stg.pagure.io'
|
| |
+ PAGURE_DIST_GIT_URL = 'https://src.stg.fedoraproject.org'
|
| |
+ PDCURL = 'https://pdc.stg.fedoraproject.org/rest_api/v1/'
|
| |
+ MDAPIURL = 'https://apps.stg.fedoraproject.org/mdapi/'
|
| |
+ else:
|
| |
+ FASURL = 'https://admin.fedoraproject.org/accounts'
|
| |
+ FASINSECURE = False
|
| |
+ PAGUREURL = 'https://pagure.io'
|
| |
+ PAGURE_DIST_GIT_URL = 'https://src.fedoraproject.org'
|
| |
+ PDCURL = 'https://pdc.fedoraproject.org/rest_api/v1/'
|
| |
+ MDAPIURL = 'https://apps.fedoraproject.org/mdapi/'
|
| |
|
| |
|
| |
EMAIL_FROM = 'accounts@fedoraproject.org'
|
| |
@@ -452,22 +452,21 @@
|
| |
|
| |
This will be replaced by sending messages to a log later.
|
| |
'''
|
| |
- {% if env == 'staging' %}
|
| |
- # Send no email in staging...
|
| |
- pass
|
| |
- {% else %}
|
| |
- msg = Message()
|
| |
- msg.add_header('To', ','.join(toAddress))
|
| |
- msg.add_header('From', fromAddress)
|
| |
- msg.add_header('Subject', subject)
|
| |
- if ccAddress is not None:
|
| |
- msg.add_header('Cc', ','.join(ccAddress))
|
| |
- toAddress = toAddress + ccAddress
|
| |
- msg.set_payload(message)
|
| |
- smtp = smtplib.SMTP('bastion')
|
| |
- smtp.sendmail(fromAddress, toAddress, msg.as_string())
|
| |
- smtp.quit()
|
| |
- {% endif %}
|
| |
+ if env == 'staging':
|
| |
+ # Send no email in staging...
|
| |
+ pass
|
| |
+ else:
|
| |
+ msg = Message()
|
| |
+ msg.add_header('To', ','.join(toAddress))
|
| |
+ msg.add_header('From', fromAddress)
|
| |
+ msg.add_header('Subject', subject)
|
| |
+ if ccAddress is not None:
|
| |
+ msg.add_header('Cc', ','.join(ccAddress))
|
| |
+ toAddress = toAddress + ccAddress
|
| |
+ msg.set_payload(message)
|
| |
+ smtp = smtplib.SMTP('bastion')
|
| |
+ smtp.sendmail(fromAddress, toAddress, msg.as_string())
|
| |
+ smtp.quit()
|
| |
|
| |
|
| |
def notify_users(errors):
|
| |
@@ -723,13 +722,12 @@
|
| |
poc=poc,
|
| |
watchers=pagure_namespace_to_cc[namespace][name],
|
| |
))
|
| |
- {% if env == 'staging' %}
|
| |
- # Filter out any modules, since we don't have rights to create new
|
| |
- # components in the "Fedora Modules" project yet
|
| |
- pagure_projects = [
|
| |
- p for p in pagure_projects if p['namespace'] != 'modules'
|
| |
- ]
|
| |
- {% endif %}
|
| |
+ if env == 'staging':
|
| |
+ # Filter out any modules, since we don't have rights to create new
|
| |
+ # components in the "Fedora Modules" project yet
|
| |
+ pagure_projects = [
|
| |
+ p for p in pagure_projects if p['namespace'] != 'modules'
|
| |
+ ]
|
| |
|
| |
branches_url = PDCURL.split('rest_api')[0] + 'extras/active_branches.json'
|
| |
if VERBOSE:
|
| |
Replace template variables by normal Python ones, which we want to be
able to set in a configuration file in the future.
Signed-off-by: Nils Philippsen nils@redhat.com