summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Maas <opensource@till.name>2010-07-04 08:15:12 (GMT)
committerLuke Macken <lmacken@redhat.com>2010-07-13 21:00:26 (GMT)
commit44f5d5a0ab0e6a638ac0b9722d773f388057a8e8 (patch)
tree816b1a1226aa48d0e8a7e1132d466d8a4ba2b387
parent902da8129903a0390a8f591e1ab7b3dedf10a776 (diff)
downloadbodhi-44f5d5a0ab0e6a638ac0b9722d773f388057a8e8.zip
bodhi-44f5d5a0ab0e6a638ac0b9722d773f388057a8e8.tar.gz
bodhi-44f5d5a0ab0e6a638ac0b9722d773f388057a8e8.tar.xz
print query results to stdout instead of stderr
This allows to use the information one is interested in other scripts using a pipe, e.g. to get a list of critpath builds that are not yet approved, one can use: ./client.py 2>/dev/null --critpath --untested --release F13 | cut -d" " -f 2
-rwxr-xr-xbodhi/tools/client.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/bodhi/tools/client.py b/bodhi/tools/client.py
index c796abb..fb058b2 100755
--- a/bodhi/tools/client.py
+++ b/bodhi/tools/client.py
@@ -157,7 +157,7 @@ def main():
log.info(data['tg_flash'])
if 'updates' in data:
for update in data['updates']:
- log.info(bodhi.update_str(update))
+ print(bodhi.update_str(update).encode("UTF-8"))
else:
verify_args(args)
@@ -177,7 +177,7 @@ def main():
log.info(data['tg_flash'])
if 'updates' in data:
for update in data['updates']:
- log.info(bodhi.update_str(update))
+ print(bodhi.update_str(update).encode("UTF-8"))
elif opts.edit:
verify_args(args)
@@ -187,14 +187,14 @@ def main():
request=opts.request)
log.info(data['tg_flash'])
if data.has_key('update'):
- log.info(bodhi.update_str(data['update']))
+ print(bodhi.update_str(data['update']).encode("UTF-8"))
elif opts.request:
verify_args(args)
data = bodhi.request(update=args[0], request=opts.request)
log.info(data['tg_flash'])
if data.has_key('update'):
- log.info(bodhi.update_str(data['update']))
+ print(bodhi.update_str(data['update']).encode("UTF-8"))
elif opts.delete:
verify_args(args)
@@ -283,7 +283,7 @@ def main():
if opts.type_:
if not update['type'] == opts.type_:
continue
- log.info(bodhi.update_str(update, minimal=opts.verbose))
+ print(bodhi.update_str(update, minimal=opts.verbose).encode("UTF-8"))
elif opts.candidates:
for build in bodhi.candidates():
@@ -298,7 +298,7 @@ def main():
if data['tg_flash']:
log.info(data['tg_flash'])
if data.has_key('update'):
- log.info(bodhi.update_str(data['update']))
+ print(bodhi.update_str(data['update']).encode("UTF-8"))
elif opts.latest:
data = bodhi.latest_builds(package=opts.latest)
@@ -310,7 +310,7 @@ def main():
data.sort(cmp=lambda x, y: cmp(x[0].split('-')[1],
y[0].split('-')[1]))
for dist, build in data:
- log.info('%26s %s' % (dist, build))
+ print('%26s %s' % (dist, build))
elif opts.critpath:
log.info("Getting a list of critical path updates...")
@@ -321,14 +321,14 @@ def main():
if data['tg_flash']:
log.info(data['tg_flash'])
for update in data['updates']:
- log.info(bodhi.update_str(update, minimal=not opts.verbose))
+ print(bodhi.update_str(update, minimal=not opts.verbose).encode("UTF-8"))
log.info("%d pending critical path updates found" % (
len(data['updates'])))
elif opts.mine and not args:
data = bodhi.query(mine=opts.mine)
for update in data['updates']:
- log.info(bodhi.update_str(update, minimal=True))
+ print(bodhi.update_str(update, minimal=True).encode("UTF-8"))
log.debug(data)
log.info(data['title'])
@@ -340,12 +340,12 @@ def main():
sys.exit(-1)
if data['num_items'] > 1:
for update in data['updates']:
- log.info(bodhi.update_str(update, minimal=True))
+ print(bodhi.update_str(update, minimal=True).encode("UTF-8"))
log.info("%d updates found (%d shown)" % (
data['num_items'], len(data['updates'])))
else:
for update in data['updates']:
- log.info(bodhi.update_str(update))
+ print(bodhi.update_str(update).encode("UTF-8"))
if args:
for arg in args:
data = bodhi.query(package=arg, release=opts.release,
@@ -369,7 +369,7 @@ def main():
log.info("%d possible updates were found" %
len(data['updates']))
for update in data['updates']:
- log.info(bodhi.update_str(update, minimal=True))
+ print(bodhi.update_str(update, minimal=True).encode("UTF-8"))
else:
update = data['updates'][0]
log.info("Downloading %s..." % update['title'])