Exemple #1
0
        headers['importType'] = kws['type']
    elif msgtype in ('Tag', 'Untag'):
        headers['tag'] = kws['tag']['name']
        build = kws['build']
        headers['name'] = build['name']
        headers['version'] = build['version']
        headers['release'] = build['release']
        headers['user'] = kws['user']['name']
    elif msgtype == 'RepoInit':
        headers['tag'] = kws['tag']['name']
    elif msgtype == 'RepoDone':
        headers['tag'] = kws['repo']['tag_name']

    return headers

@callback(*[c for c in callbacks.keys() if c.startswith('post')])
@ignore_error
def send_message(cbtype, *args, **kws):
    global config
    sender = get_sender()
    if cbtype.startswith('post'):
        msgtype = cbtype[4:]
    else:
        msgtype = cbtype[3:]

    data = kws.copy()
    if args:
        data['args'] = list(args)

    exchange_type = config.get('exchange', 'type')
    if exchange_type == 'topic':
Exemple #2
0
        headers['tag'] = kws['tag']['name']
        build = kws['build']
        headers['name'] = build['name']
        headers['version'] = build['version']
        headers['release'] = build['release']
        headers['user'] = kws['user']['name']
    elif msgtype == 'RepoInit':
        headers['tag'] = kws['tag']['name']
    elif msgtype == 'RepoDone':
        headers['tag'] = kws['repo']['tag_name']

    return headers


@callback(*[
    c for c in callbacks.keys() if c.startswith('post') and c != 'postCommit'
])
@ignore_error
@convert_datetime
def send_message(cbtype, *args, **kws):
    global config
    sender = get_sender()
    if cbtype.startswith('post'):
        msgtype = cbtype[4:]
    else:
        msgtype = cbtype[3:]

    data = kws.copy()
    if args:
        data['args'] = list(args)
Exemple #3
0
        headers['importType'] = kws['type']
    elif msgtype in ('Tag', 'Untag'):
        headers['tag'] = kws['tag']['name']
        build = kws['build']
        headers['name'] = build['name']
        headers['version'] = build['version']
        headers['release'] = build['release']
        headers['user'] = kws['user']['name']
    elif msgtype == 'RepoInit':
        headers['tag'] = kws['tag']['name']
    elif msgtype == 'RepoDone':
        headers['tag'] = kws['repo']['tag_name']

    return headers

@callback(*[c for c in callbacks.keys() if c.startswith('post')
            and c != 'postCommit'])
@ignore_error
def send_message(cbtype, *args, **kws):
    global config
    sender = get_sender()
    if cbtype.startswith('post'):
        msgtype = cbtype[4:]
    else:
        msgtype = cbtype[3:]

    data = kws.copy()
    if args:
        data['args'] = list(args)

    exchange_type = config.get('exchange', 'type')
Exemple #4
0
# Example Koji callback
# Copyright (c) 2009-2014 Red Hat, Inc.
# This callback simply logs all of its args using the logging module
#
# Authors:
#     Mike Bonnet <*****@*****.**>

from koji.plugin import callbacks, callback, ignore_error
import logging

@callback(*callbacks.keys())
@ignore_error
def echo(cbtype, *args, **kws):
    logging.getLogger('koji.plugin.echo').info('Called the %s callback, args: %s; kws: %s',
                                               cbtype, str(args), str(kws))
            msg['old'] = kws['old']
            msg['new'] = kws['new']
            msg['info'] = kws['info']
        else:
            # v1.11.0 (and maybe higher, but who knows)
            msg['sigkey'] = kws['sigkey']
            msg['sighash'] = kws['sighash']
            msg['build'] = kws['build']
            msg['rpm'] = kws['rpm']

    return msg


# This callback gets run for every koji event that starts with "post"
@callback(*[
    c for c in callbacks.keys()
    if c.startswith('post') and c not in [
        'postImport', # This is kind of useless; also noisy.
        # This one is special, and is called every time, so ignore it.
        # Added here https://pagure.io/koji/pull-request/148
        'postCommit',
    ]
])
@ignore_error
def queue_message(cbtype, *args, **kws):
    if cbtype.startswith('post'):
        msgtype = cbtype[4:]
    else:
        msgtype = cbtype[3:]

    # Short-circuit ourselves for task events.  They are very spammy and we are
            msg['old'] = kws['old']
            msg['new'] = kws['new']
            msg['info'] = kws['info']
        else:
            # v1.11.0 (and maybe higher, but who knows)
            msg['sigkey'] = kws['sigkey']
            msg['sighash'] = kws['sighash']
            msg['build'] = kws['build']
            msg['rpm'] = kws['rpm']

    return msg


# This callback gets run for every koji event that starts with "post"
@callback(*[
    c for c in callbacks.keys()
    if c.startswith('post') and c not in [
        'postImport', # This is kind of useless; also noisy.
        # This one is special, and is called every time, so ignore it.
        # Added here https://pagure.io/koji/pull-request/148
        'postCommit',
    ]
])
@ignore_error
def queue_message(cbtype, *args, **kws):
    if cbtype.startswith('post'):
        msgtype = cbtype[4:]
    else:
        msgtype = cbtype[3:]

    # Short-circuit ourselves for task events.  They are very spammy and we are
Exemple #7
0
    elif msgtype in ("Tag", "Untag"):
        headers["tag"] = kws["tag"]["name"]
        build = kws["build"]
        headers["name"] = build["name"]
        headers["version"] = build["version"]
        headers["release"] = build["release"]
        headers["user"] = kws["user"]["name"]
    elif msgtype == "RepoInit":
        headers["tag"] = kws["tag"]["name"]
    elif msgtype == "RepoDone":
        headers["tag"] = kws["repo"]["tag_name"]

    return headers


@callback(*[c for c in callbacks.keys() if c.startswith("post")])
@ignore_error
def send_message(cbtype, *args, **kws):
    global config
    sender = get_sender()
    if cbtype.startswith("post"):
        msgtype = cbtype[4:]
    else:
        msgtype = cbtype[3:]

    data = kws.copy()
    if args:
        data["args"] = list(args)

    exchange_type = config.get("exchange", "type")
    if exchange_type == "topic":
Exemple #8
0
# Example Koji callback
# Copyright (c) 2009-2014 Red Hat, Inc.
# This callback simply logs all of its args using the logging module
#
# Authors:
#     Mike Bonnet <*****@*****.**>

from __future__ import absolute_import

import logging

from koji.plugin import callback, callbacks, ignore_error
from koji.util import to_list


@callback(*to_list(callbacks.keys()))
@ignore_error
def echo(cbtype, *args, **kws):
    logging.getLogger('koji.plugin.echo').info(
        'Called the %s callback, args: %s; kws: %s', cbtype, str(args),
        str(kws))
    elif topic == 'repo.done':
        msg['tag'] = kws['repo']['tag_name']
        msg['tag_id'] = kws['repo']['tag_id']
        msg['repo_id'] = kws['repo']['id']
    elif topic == 'rpm.sign':
        msg['attribute'] = kws['attribute']
        msg['old'] = kws['old']
        msg['new'] = kws['new']
        msg['info'] = kws['info']

    return msg


# This callback gets run for every koji event that starts with "post"
@callback(*[
    c for c in callbacks.keys() if c.startswith('post') and c not in [
        'postImport',  # This is kind of useless; also noisy.
    ]
])
@ignore_error
def send_message(cbtype, *args, **kws):
    if cbtype.startswith('post'):
        msgtype = cbtype[4:]
    else:
        msgtype = cbtype[3:]

    # Short-circuit ourselves for task events.  They are very spammy and we are
    # only interested in state changes to scratch builds (parent tasks).
    if cbtype == 'postTaskStateChange':
        # only state changes
        if not kws.get('attribute', None) == 'state':
Exemple #10
0
# Example Koji callback
# Copyright (c) 2009-2014 Red Hat, Inc.
# This callback simply logs all of its args using the logging module
#
# Authors:
#     Mike Bonnet <*****@*****.**>

from __future__ import absolute_import
from koji.plugin import callbacks, callback, ignore_error
from koji.util import to_list
import logging

@callback(*to_list(callbacks.keys()))
@ignore_error
def echo(cbtype, *args, **kws):
    logging.getLogger('koji.plugin.echo').info('Called the %s callback, args: %s; kws: %s',
                                               cbtype, str(args), str(kws))