Merge lp:~jderose/ubiquity/fix-1539266 into lp:~ubuntu-installer/ubiquity/trusty-proposed

Proposed by Jason Gerard DeRose
Status: Merged
Approved by: Mathieu Trudel-Lapierre
Approved revision: 6203
Merged at revision: 6203
Proposed branch: lp:~jderose/ubiquity/fix-1539266
Merge into: lp:~ubuntu-installer/ubiquity/trusty-proposed
Diff against target: 27 lines (+10/-0)
1 file modified
ubiquity/misc.py (+10/-0)
To merge this branch: bzr merge lp:~jderose/ubiquity/fix-1539266
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Approve
Review via email: mp+284364@code.launchpad.net

Description of the change

1) Adds SMBIOS28_JUNK module variable for better readability when using this value within dmimodel().

2) Changes dmimodel() to check if the resulting model starts with SMBIOS28_JUNK, and if so, to strip this prefix.

The comment above SMBIOS28_JUNK provides an explanation, and this bug provides more background:

https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1539266

In the future, I do wonder if it might be better for Ubiquity to get these values from /sys/class/dmi/id/*.

To post a comment you must log in.
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Looks fine to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubiquity/misc.py'
2--- ubiquity/misc.py 2014-09-12 19:16:44 +0000
3+++ ubiquity/misc.py 2016-01-28 23:10:13 +0000
4@@ -600,6 +600,14 @@
5 return text
6
7
8+# On hardware that uses SMBIOS 2.8+, dmidecode 2.12 will contain this warning
9+# message prefixed before system-version, system-product-name, etc. This is
10+# problematic as the default hostname built by Ubiquity wont be valid (it's too
11+# long), so we strip this prefix. Note there is no reason to forward-port this
12+# to Xenial as it uses dmidecode 3.0, which doesn't have this problem.
13+SMBIOS28_JUNK = 'SMBIOS-implementations-newer-than-version-2-8-are-not-fully-\
14+supported-by-this-version-of-dmidecode-'
15+
16 @raise_privileges
17 def dmimodel():
18 model = ''
19@@ -638,6 +646,8 @@
20 model = re.sub('[^a-zA-Z0-9]+', '-', model).rstrip('-').lstrip('-')
21 if model.lower() == 'not-available':
22 return
23+ if model.startswith(SMBIOS28_JUNK):
24+ model = model[len(SMBIOS28_JUNK):]
25 except Exception:
26 syslog.syslog(syslog.LOG_ERR, 'Unable to determine the model from DMI')
27 finally:

Subscribers

People subscribed via source and target branches