| |
@@ -31,13 +31,13 @@
|
| |
from funcsigs import signature
|
| |
|
| |
|
| |
- class BaseTrigger(object):
|
| |
+ class BaseEvent(object):
|
| |
|
| |
_parsers = {}
|
| |
|
| |
def __init__(self, msg_id):
|
| |
"""
|
| |
- A base class to abstract triggers from different fedmsg messages.
|
| |
+ A base class to abstract events from different fedmsg messages.
|
| |
:param msg_id: the id of the msg (e.g. 2016-SomeGUID)
|
| |
"""
|
| |
self.msg_id = msg_id
|
| |
@@ -57,19 +57,19 @@
|
| |
@classmethod
|
| |
def register_parser(cls, parser_class):
|
| |
"""
|
| |
- Registers a parser for BaseTrigger which is used to parse
|
| |
+ Registers a parser for BaseEvent which is used to parse
|
| |
fedmsg in `from_fedmsg(...)` method.
|
| |
"""
|
| |
- BaseTrigger._parsers[parser_class.name] = parser_class()
|
| |
+ BaseEvent._parsers[parser_class.name] = parser_class()
|
| |
|
| |
@classmethod
|
| |
- def get_parsing_topics(cls):
|
| |
+ def get_parsed_topics(cls):
|
| |
"""
|
| |
Returns the list of topics this class is parsing using the
|
| |
registered parsers.
|
| |
"""
|
| |
topic_suffixes = []
|
| |
- for parser in BaseTrigger._parsers.values():
|
| |
+ for parser in BaseEvent._parsers.values():
|
| |
topic_suffixes.extend(parser.topic_suffixes)
|
| |
return ['{}.{}.'.format(pref.rstrip('.'), cat)
|
| |
for pref, cat
|
| |
@@ -106,14 +106,14 @@
|
| |
@staticmethod
|
| |
def from_fedmsg(topic, msg):
|
| |
"""
|
| |
- Takes a fedmsg topic and message and converts it to a BaseTrigger
|
| |
+ Takes a fedmsg topic and message and converts it to a BaseEvent
|
| |
object.
|
| |
:param topic: the topic of the fedmsg message
|
| |
:param msg: the message contents from the fedmsg message
|
| |
- :return: an object of BaseTrigger descent if the message is a type
|
| |
+ :return: an object of BaseEvent descent if the message is a type
|
| |
that the app looks for, otherwise None is returned
|
| |
"""
|
| |
- for parser in BaseTrigger._parsers.values():
|
| |
+ for parser in BaseEvent._parsers.values():
|
| |
if not parser.can_parse(topic, msg):
|
| |
continue
|
| |
|
| |
@@ -122,8 +122,8 @@
|
| |
return None
|
| |
|
| |
|
| |
- class ModuleBuilt(BaseTrigger):
|
| |
- """ A class that inherits from BaseTrigger to provide a trigger
|
| |
+ class ModuleBuilt(BaseEvent):
|
| |
+ """ A class that inherits from BaseEvent to provide an event
|
| |
object for a module event generated by module-build-service
|
| |
:param msg_id: the id of the msg (e.g. 2016-SomeGUID)
|
| |
:param module_build_id: the id of the module build
|
| |
@@ -135,9 +135,9 @@
|
| |
self.module_build_state = module_build_state
|
| |
|
| |
|
| |
- class ModuleMetadataUpdated(BaseTrigger):
|
| |
+ class ModuleMetadataUpdated(BaseEvent):
|
| |
"""
|
| |
- Provides a trigger object for "Module metadata in dist-git updated".
|
| |
+ Provides an event object for "Module metadata in dist-git updated".
|
| |
:param scm_url: SCM URL of a updated module.
|
| |
:param branch: Branch of updated module.
|
| |
"""
|
| |
@@ -147,9 +147,9 @@
|
| |
self.branch = branch
|
| |
|
| |
|
| |
- class TestingTrigger(BaseTrigger):
|
| |
+ class TestingEvent(BaseEvent):
|
| |
"""
|
| |
- Trigger useds in unit-tests.
|
| |
+ Event useds in unit-tests.
|
| |
"""
|
| |
def __init__(self, msg_id):
|
| |
- super(TestingTrigger, self).__init__(msg_id)
|
| |
+ super(TestingEvent, self).__init__(msg_id)
|
| |