Add cpu-microcode detect-plugin. #11

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

xnox commented Oct 30, 2014

Whitelist microcode packages for autoinstallation.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/1386257

Signed-off-by: Dimitri John Ledkov dimitri.j.ledkov@intel.com

Add cpu-microcode detect-plugin.
Whitelist microcode packages for autoinstallation.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/1386257

Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Contributor

xnox commented Feb 14, 2015

May I upload this into ubuntu?

detect-plugins/cpu-microcode.py
+ for line in file:
+ if line.startswith('vendor_id'):
+ cpu = line.split(':')[1].strip()
+ return [db.get(cpu)]
@martinpitt

martinpitt Feb 16, 2015

Collaborator

If the vendor is not in db, then this will return [None]. Would be better to do something like

 try:
     return [db[cpu]]
 except KeyError:
     break

?

@xnox

xnox Feb 19, 2015

Contributor

Yes that would be better. Also other plugins do not have return, or return None if nothing is detected. So that would work. Thanks for this. I'll land this now, to get into feature freeze =/ =)

Collaborator

martinpitt commented Feb 16, 2015

Aside from that, it looks good to me, thanks!

Owner

xnox commented on 1ca8d7e Feb 19, 2015

I somehow didn't know that returning None is redundant, as that is implied.
Instead of catching a KeyError i've decided to explicitly check if a value is present in dictioary and return it.

Collaborator

martinpitt commented Feb 19, 2015

Thanks! Merged.

@martinpitt martinpitt closed this Feb 19, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment