from common import git
from common import buildservice
from common.gerrit import Gerrit
+from common.send_mail import prepare_mail
from requests.mailer import mailer
import json
MAILINGLIST.split(','), BCC_MAILS, data, SR_ENABLE_USER, EMAIL_TEMPLATES_DIR)
print status
if status:
- with codecs.open('%s.env' %(BUILD_TAG), mode='w', encoding='utf-8') as f:
- for key in status.keys():
- f.write('%s=%s\n' %(key, status[key]))
+ prepare_mail("%s.env" %(BUILD_TAG), status['subject'], status['body'], NOREPLY_EMAIL_SENDER, status['To'])
event = json.loads(' '.join(OBS_EVENT_STRING.split()))
event_fields = event['fields']['obsEvent']
'tgtprj': 'deleteproject',
},
{
- 'temp': 'obs_request_maintainer',
- 'cond': lambda bs, req: req['role'] and req['person'],
- 'sub': '${reqid}: Maintainer request for ${targetproject}/${targetpackage}',
- 'to': ['mailinglist'],
- 'cc': ['who'],
- 'from': 'who',
- 'fields':['description', 'targetproject', 'targetpackage', 'role', 'person'],
- 'detail?':False,
- 'tgtprj': 'targetproject',
- },
- {
'temp': 'obs_request_changedevel',
'cond': lambda bs, req: req['origintype'] == 'change_devel',
'sub': '${reqid}: Change devel of ${targetproject}/${targetpackage} to ${sourceproject}/${sourcepackage}',
'OBS_SRCSRV_REQUEST_ACCEPTED':
(
{
- 'temp': 'obs_request_maintainer_accept',
- 'cond': lambda bs, req: req['state'] == 'accepted' and req['role'] and req['person'],
- 'sub': '${reqid} accepted: ${role} request for ${targetproject}/${targetpackage}',
- 'to': ['author', 'person'],
- 'cc': ['mailinglist'],
- 'from': 'sender',
- 'fields':['comment', 'targetproject', 'targetpackage', 'role', 'person'],
- 'detail?':False,
- 'tgtprj': 'targetproject',
- },
- {
- 'temp': 'obs_request_delpkg_accept',
- 'cond': lambda bs, req: req['state'] == 'accepted' and req['deleteproject'] and req['deletepackage'],
- 'sub': '${reqid} accepted: ${deleteproject}/${deletepackage} was deleted',
- 'to': ['author'],
- 'cc': ['mailinglist'],
- 'from': 'sender',
- 'fields':['comment', 'deleteproject', 'deletepackage'],
- 'detail?':False,
- 'tgtprj': 'deleteproject',
- },
- {
'temp': 'obs_request_changedevel_accept',
'cond': lambda bs, req: req['state'] == 'accepted' and req['origintype'] == 'change_devel',
'sub': '${reqid} accepted: ${sourceproject}/${sourcepackage} is devel of ${targetproject}/${targetpackage}',
'OBS_SRCSRV_REQUEST_STATECHANGE':
(
{
- 'cond': lambda bs, req: req['state'] == 'declined' and req['role'] and req['person'],
- 'temp': 'obs_request_maintainer_decline',
- 'sub': '${reqid} declined: Request to maintain ${targetproject}/${targetpackage}',
- 'to': ['author'],
- 'cc': ['mailinglist'],
- 'from': 'sender',
- 'fields':['comment', 'targetproject', 'targetpackage', 'role', 'person'],
- 'detail?':False,
- 'tgtprj': 'targetproject',
- },
- {
'cond': lambda bs, req: req['state'] == 'declined' and req['deleteproject'] and req['deletepackage'],
'temp': 'obs_request_delpkg_decline',
'sub': '${reqid} declined: Request to delete ${deleteproject}/${deletepackge}',
'tgtprj': 'targetproject',
},
{
- 'cond': lambda bs, req: req['state'] == 'revoked' and req['role'] and req['person'],
- 'temp': 'obs_request_maintainer_revoke',
- 'sub': '${reqid} revoked: Request to maintain ${targetproject}/${targetpackage}',
- 'to': ['mailinglist'],
- 'cc': [],
- 'from': 'who',
- 'fields':['comment', 'targetproject', 'targetpackage', 'role', 'person'],
- 'detail?':False,
- 'tgtprj': 'targetproject',
- },
- {
'cond': lambda bs, req: req['state'] == 'revoked' and req['deleteproject'] and req['deletepackage'],
'temp': 'obs_request_delpkg_revoke',
'sub': '${reqid} revoked: Request to delete ${deleteproject}/${deletepackage}',
from string import Template
template = Template(template_str)
body = template.safe_substitute(return_dict, msg="\n".join(msg))
- return_dict['body'] = body.replace('\n','\\n')
+ return_dict['body'] = body
return return_dict