diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2026-04-17 13:00:45 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-17 13:00:45 +0300 |
| commit | a8187bb23035fe13a5a8942ad3768d5a6c819232 (patch) | |
| tree | 039fb6f0b09f14d39ca50b43664d0d5a7746c48c | |
| parent | 5c2973e5d853ff921d48ae214ec0d2554e33515c (diff) | |
| parent | 4a5cb1db2b35f4300552717f75422376f381b3bd (diff) | |
| download | vyos-1x-a8187bb23035fe13a5a8942ad3768d5a6c819232.tar.gz vyos-1x-a8187bb23035fe13a5a8942ad3768d5a6c819232.zip | |
Merge pull request #5122 from c-po/op-mode-sensors
op-mode: T8483: fix /show_sensors.py: No such file or directory
| -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) |
