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
=== modified file 'ubiquity/misc.py'
--- ubiquity/misc.py 2014-09-12 19:16:44 +0000
+++ ubiquity/misc.py 2016-01-28 23:10:13 +0000
@@ -600,6 +600,14 @@
600 return text600 return text
601601
602602
603# On hardware that uses SMBIOS 2.8+, dmidecode 2.12 will contain this warning
604# message prefixed before system-version, system-product-name, etc. This is
605# problematic as the default hostname built by Ubiquity wont be valid (it's too
606# long), so we strip this prefix. Note there is no reason to forward-port this
607# to Xenial as it uses dmidecode 3.0, which doesn't have this problem.
608SMBIOS28_JUNK = 'SMBIOS-implementations-newer-than-version-2-8-are-not-fully-\
609supported-by-this-version-of-dmidecode-'
610
603@raise_privileges611@raise_privileges
604def dmimodel():612def dmimodel():
605 model = ''613 model = ''
@@ -638,6 +646,8 @@
638 model = re.sub('[^a-zA-Z0-9]+', '-', model).rstrip('-').lstrip('-')646 model = re.sub('[^a-zA-Z0-9]+', '-', model).rstrip('-').lstrip('-')
639 if model.lower() == 'not-available':647 if model.lower() == 'not-available':
640 return648 return
649 if model.startswith(SMBIOS28_JUNK):
650 model = model[len(SMBIOS28_JUNK):]
641 except Exception:651 except Exception:
642 syslog.syslog(syslog.LOG_ERR, 'Unable to determine the model from DMI')652 syslog.syslog(syslog.LOG_ERR, 'Unable to determine the model from DMI')
643 finally:653 finally:

Subscribers

People subscribed via source and target branches