Commit 789da2bf "lp-test-ppa: Add a Job class to contain data elements" broke
the display of time:
old:
0:00:20 roundcube jammy s390x ci-train-ppa-service/4872
new:
10 roundcube jammy s390x ci-train-ppa-service/4872
Since internal data and presentation shall be split this is still needed
but not added in the parsing. Instead it is now added to the function
that outputs the running job info.
Signed-off-by: Christian Ehrhardt <email address hidden>
Fixes an exception thrown if there are jobs labeled 'private job' in the
waiting queue. The error looks like:
Traceback (most recent call last):
File "/home/bryce/bin/lp-test-ppa", line 421, in <module> showActive(release, ppa_user, ppa_name)
File "/home/bryce/bin/lp-test-ppa", line 128, in showActive
waiting = getWaiting()
File "/home/bryce/bin/lp-test-ppa", line 60, in getWaiting
jobinfo = json.loads(json_data)
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
lp-test-ppa: Add a Job class to contain data elements
Promotes a dict of job information into a class to encapsulate the
information.
Fixes a (theoretical?) bug where autopkgtest could return multiple PPAs
for a given job, which would result in a failed check here:
running = [e for e in running if e['ppa'] == target]
In the case of multiple ppas, e['ppa'] will have been set to, say,
'user/foo,user/bar' and if we're testing for 'user/foo' it will fail.
The fix is to test if target is within the list of ppas:
running = [e for e in running if target in e.ppas]
This also fixes a logic error, where the 'ppas' list is looked up, and
defaults to a string, when it should be defaulting to a list:
ppas = ','.join(jobinfo.get('ppas', '-'))
This is purely theoretical though since lp-test-ppa requires a ppa
argument be given when run, so there should always be (at least) one ppa
defined. A similar issue may exist with 'triggers' (and may be less
theoretical). Both cases are fixed by returning a list for default: