MaaS Internal Server Error 500 while parsing tags with namespaces in definition upon commissioning
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
Critical
|
Gavin Panella | ||
1.4 |
Fix Released
|
Critical
|
Gavin Panella | ||
maas (Ubuntu) |
Fix Released
|
High
|
Andres Rodriguez | ||
Saucy |
Won't Fix
|
High
|
Andres Rodriguez | ||
Trusty |
Fix Released
|
High
|
Andres Rodriguez |
Bug Description
Hello,
Description: While commissioning a node and checking stdout via a Dell RAC Console session, one can see
request to http://
during the last steps. The maas.log file shows:
ERROR 2013-11-26 15:32:48,332 maasserver #######
ERROR 2013-11-26 15:32:48,332 maasserver Traceback (most recent call last):
File "/usr/lib/
response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/
response = func(*args, **kwargs)
File "/usr/lib/
result = self.error_
File "/usr/lib/
result = meth(request, *args, **kwargs)
File "/usr/lib/
return function(self, request, *args, **kwargs)
File "/usr/lib/
self._store_
File "/usr/lib/
exit_status=
File "/usr/lib/
has_tag = evaluator(
File "xpath.pxi", line 322, in lxml.etree.
File "xpath.pxi", line 242, in lxml.etree.
File "xpath.pxi", line 227, in lxml.etree.
XPathEvalError: Undefined namespace prefix
---
Problem being a Tag:
:~$ maas-cli $profile tags new name='bsnode' comment=
(naturally, all things dollar have actual values in the command used.)
created prior to commissioning. Commissioning fails for all nodes.
In /src/metadatase
method (I assume retrieved from the node) has no namespace prefixes. Though the output viewable in MaaS does have these and
the XPath expression needs them for the tag to work/be applied to the proper node.
I have altered the method to:
- check if the received xml output does have xmlns definitions on the root element
- if so, checking for and subsequently stripping off namespace prefixes from the definition.
I'm not sure how robust the patch is.
I don't know if this is the proper procedure, posting a patch here
I don't know if the patch is in the correct format.
Any tip of how to do this in the future would be much appreciated.
I wasn't able, due to time constraints, to quickly find a convention, if existing, for xml namespace prefixes. Thus the regex uses
lower and uppercase letters. Maybe this is useful for someone who's going to fix this. It works for me but I have limited time to
test other scenarios.
Greetings,
Phil
Related branches
- Graham Binns (community): Approve
-
Diff: 97 lines (+7/-49)3 files modifieddocs/development/tagging.rst (+7/-19)
src/metadataserver/models/commissioningscript.py (+0/-8)
src/metadataserver/models/tests/test_commissioningscript.py (+0/-22)
- Raphaël Badin (community): Approve
-
Diff: 58 lines (+7/-5)3 files modifiedsrc/maasserver/models/node.py (+2/-2)
src/maasserver/models/tag.py (+1/-1)
src/metadataserver/tests/test_api.py (+4/-2)
- Gavin Panella (community): Approve
-
Diff: 97 lines (+7/-49)3 files modifieddocs/development/tagging.rst (+7/-19)
src/metadataserver/models/commissioningscript.py (+0/-8)
src/metadataserver/models/tests/test_commissioningscript.py (+0/-22)
Changed in maas: | |
assignee: | nobody → Gavin Panella (allenap) |
status: | Triaged → In Progress |
Changed in maas: | |
status: | In Progress → Fix Committed |
Changed in maas (Ubuntu): | |
assignee: | nobody → Andres Rodriguez (andreserl) |
Changed in maas (Ubuntu Saucy): | |
assignee: | nobody → Andres Rodriguez (andreserl) |
Changed in maas (Ubuntu Saucy): | |
importance: | Undecided → High |
Changed in maas (Ubuntu Trusty): | |
importance: | Undecided → High |
Changed in maas (Ubuntu Saucy): | |
status: | New → Triaged |
Changed in maas (Ubuntu Trusty): | |
status: | New → Triaged |
Changed in maas (Ubuntu Trusty): | |
status: | Triaged → Fix Released |
Changed in maas: | |
status: | Fix Committed → Fix Released |
Thanks for discovering this and reporting it. This is weird, to me at least: I changed that code to work with namespaces, but it appears that the change got lost in the wash somewhere, a merge conflict gone wrong perhaps.