Commissioning fails due to Lenovo Firmware Version
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
Critical
|
Dougal Matthews | ||
2.7 |
Fix Released
|
Critical
|
Dougal Matthews | ||
2.8 |
Fix Released
|
Critical
|
Dougal Matthews |
Bug Description
Hello,
I'm trying to commission some Lenovo servers on MaaS 2.8.1. I've tried both stable and edge (7008 and 8492).
It seems to fail in lib/python3.
the problem is the Lenovo firmware is unfortunately reported as: "-[TBE134N-2.61]-"
It looks like it is treating the firmware version itself as a regex, which gives an error: re.error: bad character range N-2 at position 111
(full regiond.log snippet below (this is initial boot example, fails with 500 internal error)
2020-08-07 13:32:16 regiond: [info] 148.187.104.70 GET /MAAS/metadata/
2020-08-07 13:32:30 maasserver: [error] #######
2020-08-07 13:32:30 maasserver: [error] Traceback (most recent call last):
File "/snap/
response = wrapped_
File "/snap/
return view_atomic(*args, **kwargs)
File "/snap/
return func(*args, **kwds)
File "/snap/
response = upcall(request, *args, **kwargs)
File "/snap/
response = func(*args, **kwargs)
File "/snap/
result = self.error_
File "/snap/
result = meth(request, *args, **kwargs)
File "/snap/
return function(self, request, *args, **kwargs)
File "/snap/
script_
File "/snap/
node_hw_regex = re.compile("^%s$" % "|".join(regexes), re.I)
File "/snap/
return _compile(pattern, flags)
File "/snap/
p = sre_compile.
File "/snap/
p = sre_parse.parse(p, flags)
File "/snap/
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "/snap/
not nested and not items))
File "/snap/
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "/snap/
not nested and not items))
File "/snap/
raise source.error(msg, len(this) + 1 + len(that))
sre_constants.
If I abort the commission and try to use WebUI to commission the server, it errors out at line 241 and doesn't even attempt to do anything.
2020-08-07 14:29:13 maasserver.
Traceback (most recent call last):
File "/snap/
self.
File "/snap/
return target()
File "/snap/
task()
File "/snap/
task()
--- <exception caught here> ---
File "/snap/
result = inContext.theWork()
File "/snap/
inContext.
File "/snap/
return self.currentCon
File "/snap/
return func(*args,**kw)
File "/snap/
return func(*args, **kwargs)
File "/snap/
result = func(*args, **kwargs)
File "/snap/
return func_outside_
File "/snap/
return func(*args, **kwargs)
File "/snap/
return func(*args, **kwds)
File "/snap/
method_name, method, params
File "/snap/
result = method(params)
File "/snap/
return action.
File "/snap/
self.
File "/snap/
script_
File "/snap/
return func_within_
File "/snap/
return func(*args, **kwds)
File "/snap/
self, testing_scripts, script_input
File "/snap/
self.
File "/snap/
node_hw_regex = re.compile("^%s$" % "|".join(regexes), re.I)
File "/snap/
return _compile(pattern, flags)
File "/snap/
p = sre_compile.
File "/snap/
p = sre_parse.parse(p, flags)
File "/snap/
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "/snap/
not nested and not items))
File "/snap/
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "/snap/
not nested and not items))
File "/snap/
raise source.error(msg, len(this) + 1 + len(that))
sre_constants.
Cheers,
Mark
Related branches
- MAAS Lander: Approve
- Adam Collard (community): Approve
-
Diff: 125 lines (+35/-24)2 files modifiedsrc/metadataserver/models/scriptset.py (+12/-24)
src/metadataserver/models/tests/test_scriptset.py (+23/-0)
- MAAS Lander: Approve
- Lee Trager (community): Approve
-
Diff: 125 lines (+35/-24)2 files modifiedsrc/metadataserver/models/scriptset.py (+12/-24)
src/metadataserver/models/tests/test_scriptset.py (+23/-0)
- MAAS Lander: Approve
- Adam Collard (community): Approve
-
Diff: 125 lines (+35/-24)2 files modifiedsrc/metadataserver/models/scriptset.py (+12/-24)
src/metadataserver/models/tests/test_scriptset.py (+23/-0)
- Adam Collard (community): Disapprove
- Dougal Matthews (community): Approve
- MAAS Lander: Approve
-
Diff: 64 lines (+25/-3)2 files modifiedsrc/metadataserver/models/scriptset.py (+2/-3)
src/metadataserver/models/tests/test_scriptset.py (+23/-0)
- MAAS Lander: Needs Fixing
- MAAS Maintainers: Pending requested
-
Diff: 24 lines (+4/-2)1 file modifiedsrc/metadataserver/models/scriptset.py (+4/-2)
Changed in maas: | |
importance: | Undecided → Medium |
Changed in maas: | |
importance: | Medium → Critical |
assignee: | nobody → Lee Trager (ltrager) |
Changed in maas: | |
assignee: | Lee Trager (ltrager) → nobody |
assignee: | nobody → Dougal Matthews (d0ugal) |
status: | Triaged → In Progress |
milestone: | none → 2.9.0b1 |
Changed in maas: | |
status: | In Progress → Fix Committed |
Changed in maas: | |
status: | Fix Committed → Fix Released |
I can confirm the error and it seems to be for the reason you guessed. We are including the name in the regex itself.
>>> import re "-[TBE134N- 2.61]-" ) dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/re.py" , line 252, in compile dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/re.py" , line 304, in _compile compile( pattern, flags) dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/sre_compile. py", line 764, in compile dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/sre_parse. py", line 948, in parse dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/sre_parse. py", line 443, in _parse_sub (_parse( source, state, verbose, nested + 1, dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/sre_parse. py", line 598, in _parse
>>> re.compile(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/
return _compile(pattern, flags)
File "/home/
p = sre_compile.
File "/home/
p = sre_parse.parse(p, flags)
File "/home/
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/home/
itemsappend
File "/home/
raise source.error(msg, len(this) + 1 + len(that))
re.error: bad character range N-2 at position 8
I think we will need to re-work this part of the code to make it safer in situations like this.