2015-11-23 15:09:01 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import fedmsg
|
2015-12-08 17:29:12 +00:00
|
|
|
import fedmsg.config
|
2015-11-23 15:09:01 +00:00
|
|
|
import json
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
def send(cmd, data):
|
2020-02-03 03:50:06 +00:00
|
|
|
topic = "compose.%s" % cmd.replace("-", ".").lower()
|
|
|
|
fedmsg.publish(topic=topic, modname="pungi", msg=data)
|
2015-11-23 15:09:01 +00:00
|
|
|
|
2019-12-06 02:54:11 +00:00
|
|
|
|
|
|
|
def main():
|
2015-11-23 15:09:01 +00:00
|
|
|
parser = argparse.ArgumentParser()
|
2020-02-03 03:50:06 +00:00
|
|
|
parser.add_argument("cmd")
|
2015-11-23 15:09:01 +00:00
|
|
|
opts = parser.parse_args()
|
2015-12-08 17:29:12 +00:00
|
|
|
|
|
|
|
config = fedmsg.config.load_config()
|
2020-02-03 03:50:06 +00:00
|
|
|
config["active"] = True # Connect out to a fedmsg-relay instance
|
|
|
|
config["cert_prefix"] = "releng" # Use this cert.
|
2015-12-08 17:29:12 +00:00
|
|
|
fedmsg.init(**config)
|
|
|
|
|
2015-11-23 15:09:01 +00:00
|
|
|
data = json.load(sys.stdin)
|
|
|
|
send(opts.cmd, data)
|