diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2022-02-21 13:27:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 13:27:42 +0300 |
commit | 10ceb4532ba0e5998db75696d09a80fb7011c50d (patch) | |
tree | 222d248dcf316b07d73048f77b2a50968a034ef8 /collectors/python.d.plugin | |
parent | d8b7b6a25f7fc0ec4d79a7f8a72c779e3bf4afd7 (diff) |
fix(python.d/nvidia_smi): use uid when can't find the username (#12184)
Diffstat (limited to 'collectors/python.d.plugin')
-rw-r--r-- | collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py b/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py index 00bc7884d5..1913e94e40 100644 --- a/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py +++ b/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py @@ -294,14 +294,13 @@ def get_username_by_pid_safe(pid, passwd_file): try: uid = os.stat(path).st_uid except (OSError, IOError): - return '' - if IS_INSIDE_DOCKER: - try: + return '' + try: + if IS_INSIDE_DOCKER: return passwd_file[uid][0] - except KeyError: - return str(uid) - else: return pwd.getpwuid(uid)[0] + except KeyError: + return str(uid) class GPU: |