From 901bc2cffef231194a5710bb068c7218590c5a91 Mon Sep 17 00:00:00 2001 From: Sebastien Boyron Date: Thu, 21 Sep 2017 14:42:40 +0200 Subject: [PATCH] Clean code, fd.close not required since open as fd if used; remove get_redirected_output from cleanup_redirection_tempfiles since output is not used (cherry picked from commit ef51f00bbc9f24485915040b863c9d034d3c272c) --- lib/ansible/modules/cloud/docker/docker_service.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/docker/docker_service.py b/lib/ansible/modules/cloud/docker/docker_service.py index c9580ddb248..24263d1a2eb 100755 --- a/lib/ansible/modules/cloud/docker/docker_service.py +++ b/lib/ansible/modules/cloud/docker/docker_service.py @@ -511,8 +511,8 @@ def make_redirection_tempfiles(): def cleanup_redirection_tempfiles(out_name, err_name): - get_redirected_output(out_name) - get_redirected_output(err_name) + for i in [out_name, err_name]: + os.remove(i) def get_redirected_output(path_name): @@ -522,7 +522,6 @@ def get_redirected_output(path_name): # strip terminal format/color chars new_line = re.sub(r'\x1b\[.+m', '', line) output.append(new_line) - fd.close() os.remove(path_name) return output