Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added the error type in the MergeStatus stanzas. If the type is not '…
…error',

avoided to send desktop notification.
  • Loading branch information
SeyZ committed Feb 25, 2013
1 parent 1b27519 commit 2efc461
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions baboon/baboon/transport.py
Expand Up @@ -166,8 +166,8 @@ def _pubsub_event(self, msg):
err = "> %s" % err_f.text
self.logger.warning(err)
notif_msg = "%s\n%s" % (notif_msg, err)

eventbus.fire('conflict-result', notif_msg)
if item['payload'].get('type') == 'error':
eventbus.fire('conflict-result', notif_msg)
else:
self.logger.debug("Received pubsub event: \n%s" %
msg['pubsub_event'])
Expand Down
3 changes: 2 additions & 1 deletion baboon/baboond/task.py
Expand Up @@ -108,7 +108,8 @@ def run(self):
self.project_name, self.username, self.dest_username)
msg = conflict_msg if self.merge_conflict else good_msg

transport.alert(self.project_name, msg, self.conflict_files)
transport.alert(self.project_name, msg, self.conflict_files,
merge_conflict=self.merge_conflict)


@logger
Expand Down
3 changes: 2 additions & 1 deletion baboon/baboond/transport.py
Expand Up @@ -64,14 +64,15 @@ def close(self):
self.disconnected.set()
self.logger.info("Disconnected from the XMPP server.")

def alert(self, node, msg, files=[]):
def alert(self, node, msg, files=[], merge_conflict=False):
""" Build a MergeStatus stanza and publish it to the pubsub node.
"""

# Build the MergeStatus stanza.
status_msg = MergeStatus()
status_msg['node'] = node
status_msg['status'] = msg
status_msg['type'] = 'error' if merge_conflict else 'ok'
status_msg.set_files(files)

try:
Expand Down
2 changes: 1 addition & 1 deletion baboon/common/stanza/rsync.py
Expand Up @@ -96,7 +96,7 @@ class MergeVerification(ElementBase):
class MergeStatus(ElementBase):
name = 'merge_status'
namespace = 'baboon'
interfaces = set(('node', 'status', 'files'))
interfaces = set(('node', 'status', 'files', 'type'))
subinterfaces = set(('files',))
plugin_attrib = 'merge_status'

Expand Down

0 comments on commit 2efc461

Please sign in to comment.