python: Migrate open statements to use with.

This is low priority, but it's nice to be consistently using the best
practice pattern.

Fixes: #12419.
This commit is contained in:
Wyatt Hoodes
2019-07-14 09:37:08 -10:00
committed by Tim Abbott
parent e97179fc87
commit e331a758c3
30 changed files with 101 additions and 81 deletions

View File

@@ -14,7 +14,8 @@ def nagios_from_file(results_file):
This file is created by various nagios checking cron jobs such as
check-rabbitmq-queues and check-rabbitmq-consumers"""
data = open(results_file).read().strip()
with open(results_file) as f:
data = f.read().strip()
pieces = data.split('|')
if not len(pieces) == 4: