Closed
Bug 597837
Opened 14 years ago
Closed 14 years ago
Confusing "ValueError: invalid resource hostname" when using cfx run with 'name' in package.json containing spaces
Categories
(Add-on SDK Graveyard :: General, defect, P2)
Add-on SDK Graveyard
General
Tracking
(Not tracked)
RESOLVED
FIXED
1.0
People
(Reporter: asqueella, Assigned: KWierso)
Details
Attachments
(1 file, 1 obsolete file)
1.01 KB,
patch
|
KWierso
:
review+
|
Details | Diff | Splinter Review |
By mistake I put this in package.json:
{
"name": "jetpack page-worker test",
"id": "jid0-saEuBy3Ndh3oeuuYgnzj9ZS5Aqs"
}
To which 'cfx run' complained:
Traceback (most recent call last):
File "/Users/nickolay/dev/jetpack-sdk/bin/cfx", line 6, in <module>
cuddlefish.run()
File "/Users/nickolay/dev/jetpack-sdk/python-lib/cuddlefish/__init__.py", line 501, in run
include_dep_tests=options.dep_tests
File "/Users/nickolay/dev/jetpack-sdk/python-lib/cuddlefish/packaging.py", line 267, in generate_build_for_target
add_dep_to_build(dep)
File "/Users/nickolay/dev/jetpack-sdk/python-lib/cuddlefish/packaging.py", line 254, in add_dep_to_build
add_section_to_build(dep_cfg, "lib", is_code=True)
File "/Users/nickolay/dev/jetpack-sdk/python-lib/cuddlefish/packaging.py", line 232, in add_section_to_build
validate_resource_hostname(name)
File "/Users/nickolay/dev/jetpack-sdk/python-lib/cuddlefish/packaging.py", line 65, in validate_resource_hostname
raise ValueError('invalid resource hostname: %s' % name)
ValueError: invalid resource hostname: jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack page-worker test-lib
Where 'jid0-saeuby3ndh3oeuuygnzj9zs5aqs-jetpack page-worker test-lib' appears to autocomplete for each of the three "tokens" in the package.json's 'name', which confused me greatly.
Should cfx just validate package.json and complain if 'name' contains spaces?
(jetpack tip, http://hg.mozilla.org/labs/jetpack-sdk/rev/0754e897a883)
Comment 1•14 years ago
|
||
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.
To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
Version: Trunk → unspecified
Assignee | ||
Comment 2•14 years ago
|
||
I fixed something like this for mixed-case names in another bug, this shouldn't be any harder. Assigning to me.
Assignee: nobody → kwierso
Updated•14 years ago
|
Priority: -- → P2
Target Milestone: --- → 1.0
Assignee | ||
Comment 3•14 years ago
|
||
This patch catches single spaces in the 'name', and throws a better error for that case.
The patch also adds a link to https://jetpack.mozillalabs.com/sdk/1.0b3/docs/dev-guide/addon-development/package-spec.html which has more information on what 'name' requires for the errors from each of the three different tests.
Attachment #521659 -
Flags: review?(dietrich)
Comment 4•14 years ago
|
||
Comment on attachment 521659 [details] [diff] [review]
Throw a better error for spaces (and some other stuff)
Can you change 1.0b3 to latest, and remove the reference to the bug (not really relevant)?
r=me with those changes, thanks!
Attachment #521659 -
Flags: review?(dietrich) → review+
Assignee | ||
Comment 5•14 years ago
|
||
(In reply to comment #4)
> Can you change 1.0b3 to latest, and remove the reference to the bug (not really
> relevant)?
Changing 1.0b3 to latest makes it redirect to https://jetpack.mozillalabs.com/sdk/1.0b4/docs/ no matter what follows "/docs/".
Comment 6•14 years ago
|
||
Then we should remove the doc link. We don't want to be in a position where we have to update this every time there's a release.
Comment 7•14 years ago
|
||
Hm, also can you file a bug for that doc problem? That sounds like bug.
Assignee | ||
Comment 8•14 years ago
|
||
Bug 645731 filed.
Assignee | ||
Comment 9•14 years ago
|
||
This is the same patch as before, but it doesn't point users to the 1.0b3 version of the docs. Since we still can't point to /latest/somepage.html, I just dropped the link from the patch.
Carrying r+ forward, unless anyone objects.
I guess this should wait for the thaw before being landed.
Attachment #521659 -
Attachment is obsolete: true
Attachment #528781 -
Flags: review+
Comment 10•14 years ago
|
||
Nice low-risk polish fix, a=myk for commission during freeze.
Keywords: checkin-needed
Comment 11•14 years ago
|
||
Comment 12•14 years ago
|
||
incidentally, "if ' ' in name" would be a bit more readable/pythonic than "if name.find(' ') >= 0" .
You need to log in
before you can comment on or make changes to this bug.
Description
•