From 8a4a04b016c99734ca96568794557613c1515399 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Wed, 7 Jun 2017 11:53:29 +0530 Subject: [PATCH] logicmonitor: remove closed statement, used for py2.4 compat (#25240) Signed-off-by: Abhijeet Kasurde --- lib/ansible/modules/monitoring/logicmonitor.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/monitoring/logicmonitor.py b/lib/ansible/modules/monitoring/logicmonitor.py index 80fabae0137..8cf07b8e5e2 100644 --- a/lib/ansible/modules/monitoring/logicmonitor.py +++ b/lib/ansible/modules/monitoring/logicmonitor.py @@ -909,15 +909,13 @@ class Collector(LogicMonitor): self.module.run_command("mkdir " + self.installdir) try: - f = open(installfilepath, "w") installer = (self.do("logicmonitorsetup", {"id": self.id, "arch": arch})) - f.write(installer) - f.closed + with open(installfilepath, "w") as write_file: + write_file.write(installer) except: self.fail(msg="Unable to open installer file for writing") - f.closed else: self.module.debug("Collector installer already exists") return installfilepath