Changes to bodhi automated pushes and handling stderr

Signed-off-by: Mohan Boddu <mboddu@redhat.com>
This commit is contained in:
Mohan Boddu 2018-11-02 21:39:02 +00:00
parent 8b6a9db705
commit b69dfd1ba0

View file

@ -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)