Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/gmarkall/buildbot
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Oct 9, 2013
2 parents c048e24 + 6c9bd14 commit 3e28e2e
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions master/contrib/post_build_request.py
@@ -1,6 +1,22 @@
#!/usr/bin/env python

# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Portions Copyright Buildbot Team Members
# Portions Copyright 2013 OpenGamma Inc. and the OpenGamma group of companies

import httplib, urllib
import getopt
import optparse
import textwrap
import getpass
Expand All @@ -11,6 +27,7 @@
# http://lists.debian.org/debian-python/2010/02/msg00016.html
try:
import json # python 2.6
assert json # silence pyflakes
except ImportError:
import simplejson as json # python 2.4 to 2.5
try:
Expand Down Expand Up @@ -163,8 +180,8 @@ def propertyCB(option, opt, value, parser):
"""))
parser.add_option("-v", "--verbose", dest='verbosity', action="count",
help=textwrap.dedent("""\
Print more detail. If specified once, show status. If secified twice,
print all data returned. Normally this will be the json version of the Change.
Print more detail. Shows the response status and reason received from the master. If
specified twice, it also shows the raw response.
"""))
parser.add_option("-H", "--host", dest='host', metavar="HOST",
default='localhost:8010',
Expand Down Expand Up @@ -210,15 +227,12 @@ def propertyCB(option, opt, value, parser):
response = conn.getresponse()
data = response.read()
exitCode=0
if response.status is not 200:
if response.status is not 202:
exitCode=1
if options.verbosity >= 1:
print response.status, response.reason
if response.status is 200:
res =json.loads(data)
print "Request %d at %s" % (res[0]['number'], res[0]['at'])
if options.verbosity >= 2:
print "Raw response %s" % (data)
print "Raw response: %s" % (data)
conn.close()
os._exit(exitCode)

0 comments on commit 3e28e2e

Please sign in to comment.