powertop2tuned: do not crash if powertop is not installed
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
aa30d5e165
commit
9dd7994ca6
2 changed files with 10 additions and 3 deletions
|
|
@ -185,10 +185,16 @@ class PowertopProfile:
|
||||||
print "Running PowerTOP, please wait..."
|
print "Running PowerTOP, please wait..."
|
||||||
environment = os.environ.copy()
|
environment = os.environ.copy()
|
||||||
environment["LC_ALL"] = "C"
|
environment["LC_ALL"] = "C"
|
||||||
proc = Popen(["/usr/sbin/powertop", "--html=/tmp/powertop", "--time=1"], stdout=PIPE, stderr=PIPE, env=environment)
|
try:
|
||||||
output = proc.communicate()[1]
|
proc = Popen(["/usr/sbin/powertop", "--html=/tmp/powertop", "--time=1"], stdout=PIPE, stderr=PIPE, env=environment)
|
||||||
|
output = proc.communicate()[1]
|
||||||
|
except (OSError, IOError):
|
||||||
|
print >> sys.stderr, 'Unable to execute PowerTOP, is PowerTOP installed?'
|
||||||
|
return -2
|
||||||
|
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
return ret
|
print >> sys.stderr, 'PowerTOP returned error code: %d' % proc.returncode
|
||||||
|
return -2
|
||||||
|
|
||||||
prefix = "PowerTOP outputing using base filename "
|
prefix = "PowerTOP outputing using base filename "
|
||||||
if output.find(prefix) == -1:
|
if output.find(prefix) == -1:
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ network and ATA harddisk devices are implemented.
|
||||||
%package utils
|
%package utils
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
Summary: Various tuned utilities
|
Summary: Various tuned utilities
|
||||||
|
Requires: powertop
|
||||||
|
|
||||||
%description utils
|
%description utils
|
||||||
This package contains utilities that can help you to fine tune your
|
This package contains utilities that can help you to fine tune your
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue