Update zuul-changes for use with zuul-client

The gearman RPC methods are being removed, so this needs a change
to work with one of the web-based methods.  The most simpla end
forward-looking method is zuul-client, so update it to use that.

Change-Id: If3f6ca4bae2b2beddb3bb71b36fdcba112722186
This commit is contained in:
James E. Blair 2021-12-14 09:17:07 -08:00
parent 9a2fd432f1
commit f70319e5a5
1 changed files with 14 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright 2013 OpenStack Foundation
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
@ -26,8 +26,15 @@ parser.add_argument('url', help='The URL of the running Zuul instance')
parser.add_argument('tenant', help='The Zuul tenant', nargs='?')
parser.add_argument('pipeline', help='The name of the Zuul pipeline',
nargs='?')
parser.add_argument('--use-config',
metavar='CONFIG',
help='The name of the zuul-client config to use')
options = parser.parse_args()
command = 'zuul-client'
if options.use_config:
command += f' --use-config {options.use_config}'
# Check if tenant is white label
info = json.loads(urlopen('%s/api/info' % options.url).read())
api_tenant = info.get('info', {}).get('tenant')
@ -65,20 +72,22 @@ for tenant in tenants:
if change['id'] and ',' in change['id']:
# change triggered
cid, cps = change['id'].split(',')
print("zuul enqueue"
print("%s enqueue"
" --tenant %s"
" --pipeline %s"
" --project %s"
" --change %s,%s" % (tenant, pipeline['name'],
" --change %s,%s" % (command, tenant,
pipeline['name'],
change['project_canonical'],
cid, cps))
else:
# ref triggered
cmd = 'zuul enqueue-ref' \
cmd = '%s enqueue-ref' \
' --tenant %s' \
' --pipeline %s' \
' --project %s' \
' --ref %s' % (tenant, pipeline['name'],
' --ref %s' % (command, tenant,
pipeline['name'],
change['project_canonical'],
change['ref'])
if change['id']: