mirror of
https://github.com/FAUSheppy/monitoring-tools
synced 2025-12-06 03:21:35 +01:00
fix: fail gracefully on missing pw file
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import os
|
||||||
|
|
||||||
PW_FILE="/etc/rcon.pass"
|
PW_FILE="/etc/rcon.pass"
|
||||||
|
|
||||||
@@ -13,6 +14,10 @@ if __name__ == "__main__":
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
password = None
|
password = None
|
||||||
|
if not os.path.isfile(PW_FILE):
|
||||||
|
print("Insurgency CRITICAL - Missing /etc/rcon.pass".
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
with open(PW_FILE) as f:
|
with open(PW_FILE) as f:
|
||||||
password = f.read().strip()
|
password = f.read().strip()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user