From b69dfd1ba09e66ee7104fec705940d2094f55e8d Mon Sep 17 00:00:00 2001 From: Mohan Boddu Date: Fri, 2 Nov 2018 21:39:02 +0000 Subject: [PATCH] Changes to bodhi automated pushes and handling stderr Signed-off-by: Mohan Boddu --- roles/bodhi2/backend/files/bodhi-automated-pushes.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/roles/bodhi2/backend/files/bodhi-automated-pushes.py b/roles/bodhi2/backend/files/bodhi-automated-pushes.py index aacc81cfb1..e27c79b364 100644 --- a/roles/bodhi2/backend/files/bodhi-automated-pushes.py +++ b/roles/bodhi2/backend/files/bodhi-automated-pushes.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +from __future__ import print_function +import sys import requests import json import subprocess @@ -7,6 +10,11 @@ req = requests.get('https://bodhi.fedoraproject.org/composes/') bodhi_composes = req.json() if len(bodhi_composes['composes']) == 0: - bodhi_push_cmd = ["bodhi-push", "--username", "releng"] - push = subprocess.Popen(bodhi_push_cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE) + bodhi_push_cmd = ['bodhi-push', '--username', 'releng'] + push = subprocess.Popen(bodhi_push_cmd, stderr=subprocess.PIPE, stdin=subprocess.PIPE) push.stdin.write('y') + _, err = push.communicate() + push.wait() + if push.returncode != 0: + print(err, file=sys.stderr) + sys.exit(1)