From ed48fb0f255fd31af0ef401322f77f51e5ca8650 Mon Sep 17 00:00:00 2001 From: "colynn.liu" Date: Fri, 22 Jan 2016 18:05:48 +0800 Subject: [PATCH] fixed python 2.4 compatibility nf=tempfile.NamedTemporaryFile(delete=False) TypeError: NamedTemporaryFile() got an unexpected keyword argument 'delete' --- lib/ansible/modules/extras/system/pam_limits.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/system/pam_limits.py b/lib/ansible/modules/extras/system/pam_limits.py index efc3301d11..f6542a85bf 100644 --- a/lib/ansible/modules/extras/system/pam_limits.py +++ b/lib/ansible/modules/extras/system/pam_limits.py @@ -225,11 +225,16 @@ def main(): nf.write(new_limit) f.close() - nf.close() + nf.flush() # Copy tempfile to newfile module.atomic_move(nf.name, f.name) + try: + nf.close() + except: + pass + res_args = dict( changed = changed, msg = message )