From 4775c257ea61632e0460dc53ac5e13b3892fdf25 Mon Sep 17 00:00:00 2001 From: GGabriele Date: Wed, 14 Sep 2016 15:52:37 +0200 Subject: [PATCH] Fixing file writing format --- lib/ansible/modules/network/nxos/nxos_snapshot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_snapshot.py b/lib/ansible/modules/network/nxos/nxos_snapshot.py index 7b7d81781f0..ed113c6f700 100644 --- a/lib/ansible/modules/network/nxos/nxos_snapshot.py +++ b/lib/ansible/modules/network/nxos/nxos_snapshot.py @@ -561,8 +561,9 @@ def write_on_file(content, filename, module): path += '/' filepath = '{0}{1}'.format(path, filename) try: - with open(filepath, 'w') as report: - report.write(content) + report = open(filepath, 'w') + report.write(content) + report.close() except: module.fail_json(msg="Error while writing on file.")