summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2013-11-25 17:01:24 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2013-11-25 17:01:24 +0900
commit9c798b119c012ad8cacced0b80f988d24d9d2ae0 (patch)
treea7885a6c07923277269293c8d2b65756bf51b2ab
parent828b9f872f9c9df4a26fff043e48e13d59cce70b (diff)
downloadansible-9c798b119c012ad8cacced0b80f988d24d9d2ae0.tar.gz
Remove Python 2.4-incompatible 'with' statement
-rw-r--r--library/utilities/wait_for5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/utilities/wait_for b/library/utilities/wait_for
index 8644673eb5..a175afc415 100644
--- a/library/utilities/wait_for
+++ b/library/utilities/wait_for
@@ -157,7 +157,8 @@ def main():
while datetime.datetime.now() < end:
if path:
try:
- with open(path) as f:
+ f = open(path)
+ try:
if search_regex:
if re.search(search_regex, f.read(), re.MULTILINE):
break
@@ -165,6 +166,8 @@ def main():
time.sleep(1)
else:
break
+ finally:
+ f.close()
except IOError:
time.sleep(1)
pass