Skip to content

Commit

Permalink
make opening file more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
stdevel committed Jul 16, 2022
1 parent 71f07f1 commit cfcd7f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions check_omd.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def get_site_status():
)
if OPTIONS.heal:
if len(fail_srvs) == 0 and len(restarted_srvs) == 0:
return 0
return 0
returncode = 1
if len(fail_srvs) > 0:
_count = len(fail_srvs)
Expand Down Expand Up @@ -238,8 +238,8 @@ def get_site_status():
print ("CRITICAL - Lockfile exists, exit program")
sys.exit(2)
else:
f = open(lockfile, 'x')
f.close()
with open(LOCKFILE, 'x', encoding="utf8") as f:
f.close()
LOGGER.debug("created lockfile %s", LOCKFILE)
# check site status
EXITCODE = get_site_status()
Expand Down

0 comments on commit cfcd7f5

Please sign in to comment.