just changed fedora to rocket
This commit is contained in:
parent
68417f8226
commit
f1d7dadac4
@ -3,18 +3,21 @@
|
||||
# Koji callback plugin for sending notifications about events to fedora-messaging
|
||||
# Copyright (c) 2009-2023 Red Hat, Inc.
|
||||
#
|
||||
# Source: https://github.com/fedora-infra/koji-fedoramessaging
|
||||
# Source: https://src.koozali.org/infra/koji-rocketamessaging
|
||||
#
|
||||
# Authors:
|
||||
# Ralph Bean <rbean@redhat.com>
|
||||
# Mike Bonnet <mikeb@redhat.com>
|
||||
# Aurelien Bompard <abompard@fedoraproject.org>
|
||||
#
|
||||
# Amended to fit RocketChat:
|
||||
# Trevor Batley <trevor@batley.id.au>
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
import fedora_messaging.api
|
||||
import fedora_messaging.exceptions
|
||||
import rocket_messaging.api
|
||||
import rocket_messaging.exceptions
|
||||
import kojihub
|
||||
import pkg_resources
|
||||
from jsonschema.exceptions import ValidationError
|
||||
@ -315,19 +318,19 @@ def send_messages(cbtype, *args, **kws):
|
||||
log.info(f"Publishing message on topic {topic}")
|
||||
log.debug(f"Message body {message['msg']}")
|
||||
try:
|
||||
fedora_messaging.api.publish(msg)
|
||||
rocket_messaging.api.publish(msg)
|
||||
except ValidationError as e:
|
||||
log.exception(
|
||||
f"Schema for {topic} message (id {msg.id}) from Koji not valid "
|
||||
f"trying to send message as generic fedoramessaging message. "
|
||||
f"trying to send message as generic rocketmessaging message. "
|
||||
f"Error: {e}"
|
||||
)
|
||||
newmsg = fedora_messaging.api.Message(topic=topic, body=message["msg"])
|
||||
newmsg = rocket_messaging.api.Message(topic=topic, body=message["msg"])
|
||||
newmsg.id = msg.id
|
||||
fedora_messaging.api.publish(newmsg)
|
||||
except fedora_messaging.exceptions.PublishReturned as e:
|
||||
rocket_messaging.api.publish(newmsg)
|
||||
except rocket_messaging.exceptions.PublishReturned as e:
|
||||
log.warning("Fedora Messaging broker rejected message %s: %s", msg.id, e)
|
||||
except fedora_messaging.exceptions.ConnectionException as e:
|
||||
except rocket_messaging.exceptions.ConnectionException as e:
|
||||
log.warning("Error sending message %s: %s", msg.id, e)
|
||||
except Exception:
|
||||
log.exception("Un-expected error sending fedora-messaging message")
|
||||
|
Loading…
Reference in New Issue
Block a user