get_make_and_model job script needs error handling

Bug #1352376 reported by Jeff Lane 
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox Provider - Base
Fix Released
High
Jeff Lane 

Bug Description

The script for the get_make_and_model test needs some error handling:

Traceback (most recent call last):
  File "/tmp/nest-_pl8cjn6.fbd3f20087f458957ae660d98a5fba5b563896d472aaa533495e1cd9dc308272/get_make_and_model", line 17, in <module>
    raise SystemExit(main())
  File "/tmp/nest-_pl8cjn6.fbd3f20087f458957ae660d98a5fba5b563896d472aaa533495e1cd9dc308272/get_make_and_model", line 12, in main
    print_file_contents('Manufacturer', '/sys/class/dmi/id/sys_vendor')
  File "/tmp/nest-_pl8cjn6.fbd3f20087f458957ae660d98a5fba5b563896d472aaa533495e1cd9dc308272/get_make_and_model", line 6, in print_file_contents
    with open(filename) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/dmi/id/sys_vendor'

This is the result when run on an ARM system that has no DMI.

Solution: add error handling so that the test gets data from somewhere else on ARM systems, or just does not run on ARM if this data is not retrievable.

Related branches

Daniel Manrique (roadmr)
affects: checkbox → plainbox-provider-checkbox
Changed in plainbox-provider-checkbox:
status: New → Triaged
importance: Undecided → High
milestone: none → future
Revision history for this message
Jeff Lane  (bladernr) wrote :

slightly more complicated... error handling and some revising of the innards is done... but now I need to look into device-tree to add support for the device-tree analogs to the /sys/class/dmi files we use on x86 systems.

Changed in plainbox-provider-checkbox:
assignee: nobody → Jeff Lane (bladernr)
status: Triaged → In Progress
Revision history for this message
Jeff Lane  (bladernr) wrote :

Ok, so I ended up gutting and rewriting the script.

I needed code to handle both dmi (x86) and device-tree (armhf/arm64).

The problem is that device-tree is entirely arbitrary, so one system may not have the same device-tree nodes as another, and some don't support device-tree at all.

So, I converted the script to instead get the data from lshw as that comes on both x86 and arm systems rather than a bunch of platform dependent ID code.

lshw is at least "fairly" universal and does support both interfaces for system info. The script will return output like so:

Version: NOT FOUND
Model: Model Name
Manufacturer: Big OEM Company

We are looking for three items specifically, and if lshw doesn't provide that item, we simply return NOT FOUND.

I ran this on an x86 system that provided all three via DMI, an armhf system that provided only 1 of them and an arm64 system that provided 2 of the three. I pinged about whether it would work on Power, but that's still an unknown. We can deal with that separately if it comes to it.

Po-Hsu Lin (cypressyew)
Changed in plainbox-provider-checkbox:
status: In Progress → Fix Committed
Daniel Manrique (roadmr)
Changed in plainbox-provider-checkbox:
milestone: future → 0.12
Daniel Manrique (roadmr)
Changed in plainbox-provider-checkbox:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.