Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Commit

Permalink
Merge branch 'release/0.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Mar 2, 2016
2 parents 44a5d56 + c8962c0 commit 5723478
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 2 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@

0.8.1
-----

Pull Requests

- #70, Merge pull request #70 from fedora-infra/feature/only-taskotron
https://github.com/fedora-infra/fmn.rules/pull/70
- #71, Merge pull request #71 from fedora-infra/feature/nagios
https://github.com/fedora-infra/fmn.rules/pull/71
- #72, Merge pull request #72 from fedora-infra/feature/anitya-by-project
https://github.com/fedora-infra/fmn.rules/pull/72

Commits

- 0c0b98777 Only consider taskotron messages in the special taskotron rules.
https://github.com/fedora-infra/fmn.rules/commit/0c0b98777
- 36f87e8a3 Add kwargs to this rule.
https://github.com/fedora-infra/fmn.rules/commit/36f87e8a3
- 7ff5860a6 Add a nagios rule.
https://github.com/fedora-infra/fmn.rules/commit/7ff5860a6
- 519bfa2cd Add a rule to allow filtering by anitya project.
https://github.com/fedora-infra/fmn.rules/commit/519bfa2cd

0.8.0
-----

Expand Down
1 change: 1 addition & 0 deletions fmn/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from fmn.rules.mailman import *
from fmn.rules.mdapi import *
from fmn.rules.meetbot import *
from fmn.rules.nagios import *
from fmn.rules.nuancier import *
from fmn.rules.pagure import *
from fmn.rules.pkgdb import *
Expand Down
30 changes: 30 additions & 0 deletions fmn/rules/anitya.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import six

from fmn.lib.hinting import hint, prefixed as _


Expand Down Expand Up @@ -177,3 +179,31 @@ def anitya_info_update(config, message):
a project are **updated** in `anitya <https://release-monitoring.org>`_.
"""
return message['topic'].endswith('anitya.project.update')


def anitya_by_upstream_project(config, message, projects=None, *args, **kw):
""" Anything regarding a particular "upstream project"
Adding this rule will let through *any* anitya notification that pertains
to a particular "upstream project". Note that the "project" name is often
different from the distro "package" name. For instance, the package
python-requests in Fedora will have the upstream project name "requests".
You can specify a comma-separated list of upstream project names here.
"""
# We only deal in anitya messages, first off.
if not anitya_catchall(config, message):
return False

if not projects or not isinstance(projects, six.string_types):
return False

# Get the project for the message.
project = message['msg'].get('project', {}).get('name', None)

# Split the string into a list of targets
targets = [p.strip() for p in projects.split(',')]
# Filter out empty strings if someone is putting ',,,' garbage in
targets = [target for target in targets if target]

return project in targets
11 changes: 11 additions & 0 deletions fmn/rules/nagios.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from fmn.lib.hinting import hint, prefixed as _


@hint(categories=['nagios'])
def nagios_catchall(config, message, **kwargs):
""" Nagios notifications
This rule lets through messages from Fedora Infrastructure's `nagios
instance <https://admin.fedoraproject.org/nagios>`_ about service health.
"""
return message['topic'].split('.')[3] == 'nagios'
18 changes: 17 additions & 1 deletion fmn/rules/taskotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


@hint(topics=[_('taskotron.result.new')])
def taskotron_result_new(config, message):
def taskotron_result_new(config, message, **kwargs):
""" New taskotron task result
This rule lets through messages from the `taskotron
Expand All @@ -22,6 +22,10 @@ def taskotron_task(config, message, task=None):
i.e.: ``depcheck,rpmlint``.
"""

# We only operate on taskotron messages, first off.
if not taskotron_result_new(config, message):
return False

if not task:
return False

Expand All @@ -40,6 +44,10 @@ def taskotron_changed_outcome(config, message):
FAILED -> PASSED).
"""

# We only operate on taskotron messages, first off.
if not taskotron_result_new(config, message):
return False

outcome = message['msg']['result'].get('outcome')
prev_outcome = message['msg']['result'].get('prev_outcome')

Expand All @@ -61,6 +69,10 @@ def taskotron_task_outcome(config, message, outcome=None):
libtaskotron/latest/resultyaml.html#minimal-version>`_.
"""

# We only operate on taskotron messages, first off.
if not taskotron_result_new(config, message):
return False

if not outcome:
return False

Expand Down Expand Up @@ -106,6 +118,10 @@ def taskotron_release_critical_task(config, message):
``upgradepath``.
"""

# We only operate on taskotron messages, first off.
if not taskotron_result_new(config, message):
return False

task = message['msg']['task'].get('name')

return task in ['depcheck', 'upgradepath']
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def get_description():
'fedmsg',
'fedmsg_meta_fedora_infrastructure',
'dogpile.cache',
'six',
]

tests_require = [
Expand All @@ -32,7 +33,7 @@ def get_description():

setup(
name='fmn.rules',
version='0.8.0',
version='0.8.1',
description='Message processing rules for Fedora Notifications',
long_description=get_description(),
author='Ralph Bean',
Expand Down

0 comments on commit 5723478

Please sign in to comment.