From 0efbb702b98ac73e17ae2bbb3839e7ad55230c3b Mon Sep 17 00:00:00 2001 From: Fabian Zimmermann Date: Thu, 29 Mar 2018 06:54:44 +0200 Subject: [PATCH] fixes bug: puppet module is no longer updating persistent external facts (#38026) --- lib/ansible/modules/system/puppet.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/ansible/modules/system/puppet.py b/lib/ansible/modules/system/puppet.py index bba586eb5c..a54c65f06d 100644 --- a/lib/ansible/modules/system/puppet.py +++ b/lib/ansible/modules/system/puppet.py @@ -110,16 +110,16 @@ def _get_facter_dir(): def _write_structured_data(basedir, basename, data): if not os.path.exists(basedir): os.makedirs(basedir) - file_path = os.path.join(basedir, "{0}.json".format(basename)) - # This is more complex than you might normally expect because we want to - # open the file with only u+rw set. Also, we use the stat constants - # because ansible still supports python 2.4 and the octal syntax changed - out_file = os.fdopen( - os.open( - file_path, os.O_CREAT | os.O_WRONLY, - stat.S_IRUSR | stat.S_IWUSR), 'w') - out_file.write(json.dumps(data).encode('utf8')) - out_file.close() + file_path = os.path.join(basedir, "{0}.json".format(basename)) + # This is more complex than you might normally expect because we want to + # open the file with only u+rw set. Also, we use the stat constants + # because ansible still supports python 2.4 and the octal syntax changed + out_file = os.fdopen( + os.open( + file_path, os.O_CREAT | os.O_WRONLY, + stat.S_IRUSR | stat.S_IWUSR), 'w') + out_file.write(json.dumps(data).encode('utf8')) + out_file.close() def main():