• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

修訂595cff09d70a91fe4b3ff3320b57b882f9fee5c8 (tree)
時間2012-05-18 06:15:02
作者Cory Johns <johnsca@geek...>
CommiterJenny Steele

Log Message

[#4100] Added email notification on repo clone failure

Signed-off-by: Cory Johns <johnsca@geek.net>

Change Summary

差異

--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -1,10 +1,13 @@
11 import shutil
22 import logging
3+import traceback
34
45 from pylons import c
56
67 from allura.lib.decorators import task
78 from allura.lib.repository import RepositoryApp
9+from allura.lib import helpers as h
10+from allura.tasks.mail_tasks import sendmail
811
912 @task
1013 def init(**kwargs):
@@ -20,15 +23,28 @@ def clone(
2023 cloned_from_path,
2124 cloned_from_name,
2225 cloned_from_url):
23- from allura import model as M
24- c.app.repo.init_as_clone(
25- cloned_from_path,
26- cloned_from_name,
27- cloned_from_url)
28- M.Notification.post_user(
29- c.user, c.app.repo, 'created',
30- text='Repository %s/%s created' % (
31- c.project.shortname, c.app.config.options.mount_point))
26+ try:
27+ from allura import model as M
28+ c.app.repo.init_as_clone(
29+ cloned_from_path,
30+ cloned_from_name,
31+ cloned_from_url)
32+ M.Notification.post_user(
33+ c.user, c.app.repo, 'created',
34+ text='Repository %s/%s created' % (
35+ c.project.shortname, c.app.config.options.mount_point))
36+ except:
37+ sendmail(
38+ destinations=['sfengineers@geek.net'],
39+ fromaddr=u'SourceForge.net <noreply+project-upgrade@in.sf.net>',
40+ reply_to=u'noreply@in.sf.net',
41+ subject=u'SourceForge Repo Clone Failure',
42+ message_id=h.gen_message_id(),
43+ text=u''.join([
44+ u'Clone of repo %s from %s failed.\n',
45+ u'\n',
46+ u'%s',
47+ ]) % (cloned_from_name, cloned_from_url, traceback.format_exc()))
3248
3349 @task
3450 def reclone(*args, **kwargs):