diff options
| -rw-r--r-- | op-mode-definitions/show-environment.xml.in | 3 | ||||
| -rwxr-xr-x | src/op_mode/show_sensors.py | 15 |
2 files changed, 9 insertions, 9 deletions
diff --git a/op-mode-definitions/show-environment.xml.in b/op-mode-definitions/show-environment.xml.in index c71048ffc..5f4d38025 100644 --- a/op-mode-definitions/show-environment.xml.in +++ b/op-mode-definitions/show-environment.xml.in @@ -11,8 +11,7 @@ <properties> <help>Show hardware monitoring results</help> </properties> - <!-- Linux always adds "hypervisor" to CPU flags --> - <command>bash -c 'if ! grep -q hypervisor /proc/cpuinfo; then ${vyos_op_scripts_dir}/show_sensors.py; else echo "VyOS running under hypervisor, no sensors available"; fi'</command> + <command>${vyos_op_scripts_dir}/show_sensors.py</command> </leafNode> </children> </node> diff --git a/src/op_mode/show_sensors.py b/src/op_mode/show_sensors.py index 1efcc9aec..b7ff05178 100755 --- a/src/op_mode/show_sensors.py +++ b/src/op_mode/show_sensors.py @@ -17,25 +17,26 @@ import re import sys + from vyos.utils.process import popen from vyos.utils.process import DEVNULL -output,retcode = popen("sensors --no-adapter", stderr=DEVNULL) +output, retcode = popen("sensors --no-adapter", stderr=DEVNULL) if retcode == 0: print (output) sys.exit(0) else: - output,retcode = popen("sensors-detect --auto",stderr=DEVNULL) - match = re.search(r'#----cut here----(.*)#----cut here----',output, re.DOTALL) + output, retcode = popen("sensors-detect --auto", stderr=DEVNULL) + match = re.search(r'#----cut here----(.*)#----cut here----', output, + re.DOTALL) if match: for module in match.group(0).split('\n'): if not module.startswith("#"): popen("modprobe {}".format(module.strip())) - output,retcode = popen("sensors --no-adapter", stderr=DEVNULL) + output, retcode = popen("sensors --no-adapter", stderr=DEVNULL) if retcode == 0: - print (output) + print(output) sys.exit(0) - -print ("No sensors found") +print("No sensors found") sys.exit(1) |
