summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-04-12 09:31:58 +0200
committerChristian Breunig <christian@breunig.cc>2026-04-12 09:35:52 +0200
commit5e0c08a3032fb748c88a6ac10f3cf2a31a232433 (patch)
tree4551a77d73ebe9dd6b0cc8461e20e9a43484d01b /src
parentb7d191cd3053a736fa14ebfefe7a95093b0fcacd (diff)
downloadvyos-1x-5e0c08a3032fb748c88a6ac10f3cf2a31a232433.tar.gz
vyos-1x-5e0c08a3032fb748c88a6ac10f3cf2a31a232433.zip
op-mode: T8483: fix /show_sensors.py: No such file or directory
After rewriting the op-mode handlind code and introducing virtualTagNodes for op-mode, also all <command> statements will be executed by a runner. Executing "bash -c ''" code within that runner lacks the proper environment. This can be verified by adding "env" into the bash -c '' executions string. Solve this issue by moving the hypervisor detection code to show_sensors.py.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/show_sensors.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/op_mode/show_sensors.py b/src/op_mode/show_sensors.py
index 1efcc9aec..365a358ac 100755
--- a/src/op_mode/show_sensors.py
+++ b/src/op_mode/show_sensors.py
@@ -17,9 +17,17 @@
import re
import sys
+
+from vyos.utils.file import read_file
from vyos.utils.process import popen
from vyos.utils.process import DEVNULL
+cpu_info = read_file('/proc/cpuinfo')
+# Linux always adds "hypervisor" to CPU flags
+if 'hypervisor' in cpu_info:
+ print('VyOS running under hypervisor, no sensors available!')
+ sys.exit(1)
+
output,retcode = popen("sensors --no-adapter", stderr=DEVNULL)
if retcode == 0:
print (output)