Merge ~bladernr/plainbox-provider-resource:1866037-fix-cpuinfo_resource-traceback into plainbox-provider-resource:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Jeff Lane 
Approved revision: 28a04a8d2e8f82cb5f6f50d1c671b9eb3992730c
Merged at revision: f881ad94c119ba01e5510df659f03cf0dddea381
Proposed branch: ~bladernr/plainbox-provider-resource:1866037-fix-cpuinfo_resource-traceback
Merge into: plainbox-provider-resource:master
Diff against target: 16 lines (+4/-1)
1 file modified
bin/cpuinfo_resource (+4/-1)
Reviewer Review Type Date Requested Status
Rod Smith Approve
Review via email: mp+380206@code.launchpad.net

Commit message

Fixes traceback in cpuinfo_resource when attempting to open/read scaling_available_governors on systems where that does not exist.

Description of the change

Fixes traceback in cpuinfo_resource when attempting to open/read scaling_available_governors on systems where that does not exist.

To post a comment you must log in.
Revision history for this message
Rod Smith (rodsmith) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/cpuinfo_resource b/bin/cpuinfo_resource
2index 83ce78d..d00eeab 100755
3--- a/bin/cpuinfo_resource
4+++ b/bin/cpuinfo_resource
5@@ -42,7 +42,10 @@ class CpuinfoResult:
6 value = int(value) // 1000
7 if value:
8 print("%s: %s" % (key, value))
9- print("governors: %s" % open(GOVERNORS_FILENAME).read().strip())
10+ try:
11+ print("governors: %s" % open(GOVERNORS_FILENAME).read().strip())
12+ except FileNotFoundError:
13+ print("governors: GOVERNORS NOT FOUND")
14
15
16 def main():

Subscribers

People subscribed via source and target branches