From 8f08d577b0f7ef39598a6b6317b80117113d8d86 Mon Sep 17 00:00:00 2001 From: clime Date: Sat, 13 Jan 2018 23:53:30 +0100 Subject: [PATCH] add 'fedmsgs' and 'old_paths' configuration variables --- configs/dist-git/dist-git.conf | 12 ++++++++---- scripts/httpd/upload.cgi | 27 ++++++++++++++------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/configs/dist-git/dist-git.conf b/configs/dist-git/dist-git.conf index 13e17c9..c5282ab 100644 --- a/configs/dist-git/dist-git.conf +++ b/configs/dist-git/dist-git.conf @@ -2,7 +2,11 @@ git_author_name = Fedora Release Engineering git_author_email = rel-eng@lists.fedoraproject.org -cache_dir = /var/lib/dist-git/cache -gitroot_dir = /var/lib/dist-git/git -gitolite = True -grok = True +cache_dir = /var/lib/dist-git/cache +gitroot_dir = /var/lib/dist-git/git + +gitolite = True +grok = True +fedmsgs = True +old_paths = True +nomd5 = True diff --git a/scripts/httpd/upload.cgi b/scripts/httpd/upload.cgi index 1de12a3..b53a51e 100644 --- a/scripts/httpd/upload.cgi +++ b/scripts/httpd/upload.cgi @@ -238,23 +238,24 @@ def main(): hash_type.upper(), checksum) # Add the file to the old path, where fedpkg is currently looking for it - if hash_type == "md5": + if hash_type == "md5" and config['dist-git'].getboolean('old_paths', fallback=True): hardlink(dest_file, old_path, username) # Emit a fedmsg message. Load the config to talk to the fedmsg-relay. - try: - config = fedmsg.config.load_config([], None) - config['active'] = True - config['endpoints']['relay_inbound'] = config['relay_inbound'] - fedmsg.init(name="relay_inbound", cert_prefix="lookaside", **config) + if config['dist-git'].getboolean('fedmsgs', fallback=True): + try: + config = fedmsg.config.load_config([], None) + config['active'] = True + config['endpoints']['relay_inbound'] = config['relay_inbound'] + fedmsg.init(name="relay_inbound", cert_prefix="lookaside", **config) - topic = "lookaside.new" - msg = dict(name=name, md5sum=checksum, - filename=filename.split('/')[-1], agent=username, - path=msgpath) - fedmsg.publish(modname="git", topic=topic, msg=msg) - except Exception as e: - print "Error with fedmsg", str(e) + topic = "lookaside.new" + msg = dict(name=name, md5sum=checksum, + filename=filename.split('/')[-1], agent=username, + path=msgpath) + fedmsg.publish(modname="git", topic=topic, msg=msg) + except Exception as e: + print "Error with fedmsg", str(e) if __name__ == '__main__': try: