graceful handling of common issues - ppa name case handling
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ppa-dev-tools |
Fix Released
|
Undecided
|
Bryce Harrington |
Bug Description
PPA names do - by design - not allow upper case characters.
Therefore we should auto-lowercase them for the user.
And thereby avoid massive backtraces and issue like:
1. creation
$ ppa create lp-1975764-
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 = ppa_group.
File "/usr/local/
raise e
File "/usr/local/
results = self.team.
File "/usr/lib/
response, content = self.root.
File "/usr/lib/
raise error
lazr.restfulcli
Response headers:
---
-content-encoding: gzip
connection: close
content-length: 271
content-
content-type: text/plain;
date: Thu, 08 Sep 2022 08:27:14 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: 9a928cf4-
x-vcs-revision: b6507fd2ad40d55
x-xss-protection: 1; mode=block
---
Response body:
---
b"name: \nInvalid name 'lp-1975764-
---
2. trying to access with accidential upper case
$ 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: 271
content-
content-type: text/plain;
date: Thu, 08 Sep 2022 08:40:45 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: a434c856-
x-vcs-revision: b6507fd2ad40d55
x-xss-protection: 1; mode=block
---
Response body:
---
b"name: \nInvalid name 'lp-1975764-
---
Up for discussion if we want to warn the user or auto-lowercase it.
Since by design it can only ever be lower case, I'm leaning towards converting to lower case and mentioning that in --help.
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: | In Progress → Fix Committed |
Yeah this should be detected and reported better to users.
For auto-correction I'm a bit concerned that this may have some surprise if they then try to use that invalid name, especially with scripting, e.g.:
my_ppa= "lp-1975764- DPDK-mre- sept-2022"
ppa create "${my_ppa}" || exit 1
dput "${my_ppa}" "${changes_file}"
In this case $my_ppa would get auto-corrected but then the script would fail on the dput which could be bad.
The ppa name format is strict on characters that can be used, as well as length, and I don't think we'd want to autocorrect those, so I suspect it'd be most consistent to also error on capitalized letters.