Skip to content

Commit ec221f4

Browse files
Add root check
1 parent 4fd2897 commit ec221f4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

playbooks/roles/healthchecks/files/xid_checker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55
import subprocess
66
import sys
77
import re
8+
import os
89

910
class XidChecker:
1011
def __init__(self, dmesg_cmd="dmesg", time_interval=60):
12+
# if user is root
13+
if not os.geteuid() == 0:
14+
logger.info("The XidChecker script did not run since it must be run as root")
15+
sys.exit(1)
1116
self.dmesg_cmd = dmesg_cmd
1217
self.results = {}
1318

0 commit comments

Comments
 (0)