summaryrefslogtreecommitdiff
path: root/copr_messaging.patch
blob: 652ac523e02aec62ea23abb4d88f0f6eaa727556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff --git a/backend/copr_backend/msgbus.py b/backend/copr_backend/msgbus.py
index 0c224ef1..d5352041 100644
--- a/backend/copr_backend/msgbus.py
+++ b/backend/copr_backend/msgbus.py
@@ -7,7 +7,13 @@ import logging
 import copy
 import json
 
-from copr_messaging import schema
+try:
+    from copr_messaging import schema
+except ImportError:
+    # fedmsg is optional
+    copr_messaging_enabled = False
+else:
+    copr_messaging_enabled = True
 
 from .constants import BuildStatus
 
@@ -33,6 +39,8 @@ def message_from_worker_job(style, topic, job, who, ip, pid):
     once we can exepect that people are using copr-messaging module (and thus
     we can change message format without affecting the API).
     """
+    if not copr_messaging_enabled:
+        return None
     if style == 'v1':
         content = {
             'user': job.submitter,