summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Wienand <iwienand@redhat.com>2021-05-27 17:04:15 +1000
committerIan Wienand <iwienand@redhat.com>2021-05-27 17:04:15 +1000
commit01efd92d2a4e870b15076cfccc99524ffa6cbf7e (patch)
treed21b4ace33d1876cff55900d4705395f787f6f65
parent997f88185a9e7889e75e1e862a86bef6800075a3 (diff)
downloadzuul-01efd92d2a4e870b15076cfccc99524ffa6cbf7e.tar.gz
client: fix REST autohold-list response
The current REST client code takes the autohold API response and modifies it into a format that the display function can't work with. I couldn't exactly pinpoint how it got this way, but it seems emperically that the RPC response is the same as the API response; i.e. we can remove this munging and the display function can handle both. zuul --zuul-url=https://zuul.opendev.org/ autohold-list --tenant openstack is an example of this response. Change-Id: I1087041f1054244130f1b5a68a0282742d6581d7
-rwxr-xr-xzuul/cmd/client.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/zuul/cmd/client.py b/zuul/cmd/client.py
index 3a9c35ab4..d7154184c 100755
--- a/zuul/cmd/client.py
+++ b/zuul/cmd/client.py
@@ -82,17 +82,7 @@ class ZuulRESTClient(object):
'tenant/%s/autohold' % tenant)
req = requests.get(url, verify=self.verify)
self._check_status(req)
- resp = req.json()
- # reformat the answer to match RPC format
- ret = {}
- for d in resp:
- key = ','.join([d['tenant'],
- d['project'],
- d['job'],
- d['ref_filter']])
- ret[key] = (d['count'], d['reason'], d['node_hold_expiration'])
-
- return ret
+ return req.json()
def enqueue(self, tenant, pipeline, project, trigger, change):
if not self.auth_token:
@@ -494,7 +484,7 @@ class Client(zuul.cmd.ZuulApp):
table = prettytable.PrettyTable(
field_names=[
'ID', 'Tenant', 'Project', 'Job', 'Ref Filter',
- 'Max Count', 'Reason'
+ 'Current Count', 'Max Count', 'Reason'
])
for request in autohold_requests:
@@ -504,6 +494,7 @@ class Client(zuul.cmd.ZuulApp):
request['project'],
request['job'],
request['ref_filter'],
+ request['current_count'],
request['max_count'],
request['reason'],
])