graceful handling of common issues - check ppa format before engaging LP
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ppa-dev-tools |
Fix Released
|
Undecided
|
Bryce Harrington |
Bug Description
This works:
$ ppa wait ppa:paelzer/
But many other close syntaxes that are just wrong could be typed accidentially, for example:
$ ppa wait ppa/paelzer/
Traceback (most recent call last):
File "/usr/local/
__import_
File "/usr/lib/
self.
File "/usr/lib/
exec(code, namespace, namespace)
File "/usr/local/
sys.
File "/usr/local/
return func(lp, config)
File "/usr/local/
ppa = get_ppa(lp, config)
File "/usr/local/
return Ppa(
File "/usr/local/
assert team_name
AssertionError
[✗=1]─[
$ ppa wait ppa:paelzer/
Traceback (most recent call last):
File "/usr/local/
__import_
File "/usr/lib/
self.
File "/usr/lib/
exec(code, namespace, namespace)
File "/usr/local/
sys.
File "/usr/local/
return func(lp, config)
File "/usr/local/
if not ppa.has_packages():
File "/usr/local/
return list(self.
File "/usr/local/
return owner.getPPAByN
File "/usr/lib/
response, content = self.root.
File "/usr/lib/
raise error
lazr.restfulcli
Response headers:
---
-content-encoding: gzip
connection: close
content-length: 279
content-
content-type: text/plain;
date: Thu, 08 Sep 2022 08:43:56 GMT
server: gunicorn/19.8.1
status: 400
strict-
vary: Accept,
x-content-
x-frame-options: SAMEORIGIN
x-launchpad-
x-lazr-
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-request-id: 7814bcca-
x-vcs-revision: b6507fd2ad40d55
x-xss-protection: 1; mode=block
---
Response body:
---
b"name: \nInvalid name 'lp-1975764-
---
AFAICS there is a clear syntax we have to follow, should we consider throwing a regex on it before bothering LP, and gracefully tell the user "your argument seems to be wrong and does not match <format>"?
That seems more friendly and comfortable to me.
Related branches
- Lena Voytek (community): Approve
- Canonical Server: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 958 lines (+331/-225)15 files modifiedREADME.md (+2/-2)
ppa/ppa.py (+85/-37)
ppa/ppa_group.py (+21/-14)
scripts/ppa (+27/-37)
tests/helpers.py (+90/-0)
tests/test_io.py (+5/-2)
tests/test_job.py (+6/-15)
tests/test_lp.py (+2/-1)
tests/test_ppa.py (+48/-5)
tests/test_ppa_group.py (+29/-87)
tests/test_result.py (+1/-1)
tests/test_scripts_ppa.py (+1/-13)
tests/test_subtest.py (+1/-1)
tests/test_trigger.py (+1/-1)
tests/test_version.py (+12/-9)
Changed in ppa-dev-tools: | |
assignee: | nobody → Bryce Harrington (bryce) |
status: | New → In Progress |
Changed in ppa-dev-tools: | |
status: | Fix Committed → Fix Released |
The regex pre-check is not a bad idea.
At a minimum from this and other bugs it looks clear that this code needs wrapped in a try block, and the error extracted (and de-html'd) from the exception's response for the user.