zuul-changes: update for the new api url

The Zuul api url changed, this change updates the zuul-changes.py
script.

Change-Id: Id45f9a8a7e1542bef55097dd89f93a9addc91e1b
This commit is contained in:
Tristan Cacqueray 2018-03-29 09:11:35 +00:00
parent c6d9f4c6bf
commit 559af7048b
2 changed files with 18 additions and 2 deletions

View File

@ -0,0 +1,4 @@
---
fixes:
- |
The zuul-changes.py script has been adapted to the new zuul-web api routes.

View File

@ -24,8 +24,20 @@ parser.add_argument('tenant', help='The Zuul tenant')
parser.add_argument('pipeline', help='The name of the Zuul pipeline')
options = parser.parse_args()
data = urllib2.urlopen('%s/status' % options.url).read()
data = json.loads(data)
# Check if tenant is white label
info = json.loads(urllib2.urlopen('%s/api/info' % options.url).read())
api_tenant = info.get('info', {}).get('tenant')
if api_tenant:
if api_tenant == options.tenant:
status_url = '%s/api/status' % options.url
else:
print("Error: %s doesn't match tenant %s (!= %s)" % (
options.url, options.tenant, api_tenant))
exit(1)
else:
status_url = '%s/api/tenant/%s/status' % (options.url, options.tenant)
data = json.loads(urllib2.urlopen(status_url).read())
for pipeline in data['pipelines']:
if pipeline['name'] != options.pipeline: