mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Try/finally is a python 2.5 construct, so not working
on EL5. Fix #4763
This commit is contained in:
parent
e725eea4be
commit
1ef9bed752
1 changed files with 6 additions and 5 deletions
|
@ -330,12 +330,12 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
|
||||||
log("got a failed response from the master")
|
log("got a failed response from the master")
|
||||||
return dict(failed=True, stderr="Master reported failure, aborting transfer")
|
return dict(failed=True, stderr="Master reported failure, aborting transfer")
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
fd.close()
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
log("failed to fetch the file: %s" % tb)
|
log("failed to fetch the file: %s" % tb)
|
||||||
return dict(failed=True, stderr="Could not fetch the file: %s" % str(e))
|
return dict(failed=True, stderr="Could not fetch the file: %s" % str(e))
|
||||||
finally:
|
|
||||||
fd.close()
|
|
||||||
|
|
||||||
|
fd.close()
|
||||||
return dict()
|
return dict()
|
||||||
|
|
||||||
def put(self, data):
|
def put(self, data):
|
||||||
|
@ -373,10 +373,11 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
|
||||||
data = self.server.key.Decrypt(data)
|
data = self.server.key.Decrypt(data)
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
except:
|
except:
|
||||||
|
out_fd.close()
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
log("failed to put the file: %s" % tb)
|
log("failed to put the file: %s" % tb)
|
||||||
return dict(failed=True, stdout="Could not write the file")
|
return dict(failed=True, stdout="Could not write the file")
|
||||||
finally:
|
|
||||||
vvvv("wrote %d bytes" % bytes)
|
vvvv("wrote %d bytes" % bytes)
|
||||||
out_fd.close()
|
out_fd.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue