From c8fa3b285fc1d210e749a23a457248a02561405e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 25 2016 09:27:34 +0000 Subject: [PATCH 1/3] Fix the fedmsg hook This commit fixes the fedmsg hook but fixing calling the search_user() method from the internal API --- diff --git a/pagure/hooks/files/fedmsg_hook.py b/pagure/hooks/files/fedmsg_hook.py index f363c4f..da03aa8 100755 --- a/pagure/hooks/files/fedmsg_hook.py +++ b/pagure/hooks/files/fedmsg_hook.py @@ -60,7 +60,7 @@ for line in sys.stdin.readlines(): for rev in revs: email = pagure.lib.git.get_author_email(rev, abspath) name = pagure.lib.git.get_author(rev, abspath) - author = search_user(pagure.SESSION, email=email) or name + author = pagure.lib.search_user(pagure.SESSION, email=email) or name authors.add(author) if revs: From 700c335bbffb91c3c3efd26d32e6e3f6f6575c94 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 25 2016 12:36:35 +0000 Subject: [PATCH 2/3] Fix gathering the list of authors in a way that can be sent to fedmsg --- diff --git a/pagure/hooks/files/fedmsg_hook.py b/pagure/hooks/files/fedmsg_hook.py index da03aa8..d3e4cfc 100755 --- a/pagure/hooks/files/fedmsg_hook.py +++ b/pagure/hooks/files/fedmsg_hook.py @@ -56,12 +56,20 @@ for line in sys.stdin.readlines(): if not project: project = project_name - authors = set() + auths = set() for rev in revs: email = pagure.lib.git.get_author_email(rev, abspath) name = pagure.lib.git.get_author(rev, abspath) author = pagure.lib.search_user(pagure.SESSION, email=email) or name - authors.add(author) + auths.add(author) + + authors = [] + for author in auths: + if isinstance(author, basestring): + author = author + else: + author = author.to_json(public=True) + authors.append(author) if revs: revs.reverse() From a22558c7663b938799424ae92418ad869fa6b9aa Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 25 2016 12:36:53 +0000 Subject: [PATCH 3/3] Fix setting the agent doing the push This info is extracted from the environment variable set by gitolite. --- diff --git a/pagure/hooks/files/fedmsg_hook.py b/pagure/hooks/files/fedmsg_hook.py index d3e4cfc..6616fb2 100755 --- a/pagure/hooks/files/fedmsg_hook.py +++ b/pagure/hooks/files/fedmsg_hook.py @@ -84,7 +84,7 @@ for line in sys.stdin.readlines(): branch=refname, forced=forced, authors=list(authors), - agent=username, + agent=os.environ['GL_USER'], repo=project.to_json(public=True) if not isinstance(project, basestring) else project, ),