From 8693bb0902bf6ec90694eeca466a2dbf90f4b4ff Mon Sep 17 00:00:00 2001 From: Sayan Chowdhury Date: Fri, 6 Apr 2018 04:17:53 +0530 Subject: [PATCH] fedimg: Remove the fedimg hotfix Signed-off-by: Sayan Chowdhury --- files/hotfix/fedimg/consumers.py | 99 -------------------------------- roles/fedimg/tasks/main.yml | 8 --- 2 files changed, 107 deletions(-) delete mode 100644 files/hotfix/fedimg/consumers.py diff --git a/files/hotfix/fedimg/consumers.py b/files/hotfix/fedimg/consumers.py deleted file mode 100644 index 3ebd4cb0c2..0000000000 --- a/files/hotfix/fedimg/consumers.py +++ /dev/null @@ -1,99 +0,0 @@ -# This file is part of fedimg. -# Copyright (C) 2014 Red Hat, Inc. -# -# fedimg is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# fedimg is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with fedimg; if not, see http://www.gnu.org/licenses, -# or write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# -# Authors: David Gay -# - -import logging -log = logging.getLogger("fedmsg") - -import multiprocessing.pool - -import fedmsg.consumers -import fedmsg.encoding -import fedfind.release - -import fedimg.uploader -from fedimg.util import get_rawxz_urls, safeget - - -class FedimgConsumer(fedmsg.consumers.FedmsgConsumer): - """ Listens for image Koji task completion and sends image files - produced by the child createImage tasks to the uploader. """ - - # It used to be that all *image* builds appeared as scratch builds on the - # task.state.change topic. However, with the switch to pungi4, some of - # them (and all of them in the future) appear as full builds under the - # build.state.change topic. That means we have to handle both cases like - # this, at least for now. - topic = [ - 'org.fedoraproject.prod.pungi.compose.status.change', - ] - - config_key = 'fedimgconsumer' - - def __init__(self, *args, **kwargs): - super(FedimgConsumer, self).__init__(*args, **kwargs) - - # threadpool for upload jobs - self.upload_pool = multiprocessing.pool.ThreadPool(processes=4) - - log.info("Super happy fedimg ready and reporting for duty.") - - def consume(self, msg): - """ This is called when we receive a message matching our topics. """ - - log.info('Received %r %r' % (msg['topic'], msg['body']['msg_id'])) - - STATUS_F = ('FINISHED_INCOMPLETE', 'FINISHED',) - - msg_info = msg['body']['msg'] - if msg_info['status'] not in STATUS_F: - return - - location = msg_info['location'] - compose_id = msg_info['compose_id'] - cmetadata = fedfind.release.get_release_cid(compose_id).metadata - - # Till F27, both cloud-base and atomic images were available - # under variant CloudImages. With F28 and onward releases, - # cloud-base image compose moved to cloud variant and atomic images - # moved under atomic variant. - prev_rel = ['26', '27'] - if msg_info['release_version'] in prev_rel: - images_meta = safeget(cmetadata, 'images', 'payload', 'images', - 'CloudImages', 'x86_64') - else: - images_meta = safeget(cmetadata, 'images', 'payload', 'images', - 'Cloud', 'x86_64') - images_meta.extend(safeget(cmetadata, 'images', 'payload', - 'images', 'AtomicHost', 'x86_64')) - - if images_meta is None: - return - - self.upload_urls = get_rawxz_urls(location, images_meta) - compose_meta = { - 'compose_id': compose_id, - } - - if len(self.upload_urls) > 0: - log.info("Processing compose id: %s" % compose_id) - fedimg.uploader.upload(self.upload_pool, - self.upload_urls, - compose_meta) diff --git a/roles/fedimg/tasks/main.yml b/roles/fedimg/tasks/main.yml index 5ceacbabcb..4b98023843 100644 --- a/roles/fedimg/tasks/main.yml +++ b/roles/fedimg/tasks/main.yml @@ -134,11 +134,3 @@ tags: - cron - fedimg - -- name: hotfix - copy the consumers.py over to the site-packages - copy: src="{{ files }}/hotfix/fedimg/consumers.py" dest=/usr/lib/python2.7/site-packages/fedimg/consumers.py - notify: - - restart fedmsg-hub - tags: - - fedimg - - hotfix