Skip to content

Commit

Permalink
Update post_build_request to match change_hook
Browse files Browse the repository at this point in the history
Since 2e25ec7 change_hook no longer returns a JSON object with a
200 OK response code. Instead it returns a 202 Accepted code with
no data. This commit updates post_build_request.py to match this
behaviour.
  • Loading branch information
gmarkall committed Oct 4, 2013
1 parent 09fdd80 commit 6c9bd14
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions master/contrib/post_build_request.py
@@ -1,4 +1,21 @@
#!/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 optparse
import textwrap
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 6c9bd14

Please sign in to comment.