Merge pull request #551 from cchurch/🥓

Include JSON string in temporary inventory script with %r
This commit is contained in:
Chris Church
2017-11-06 17:46:12 -05:00
committed by GitHub

View File

@@ -680,7 +680,7 @@ class BaseTask(LogErrorsTask):
path = os.path.join(kwargs['private_data_dir'], 'inventory') path = os.path.join(kwargs['private_data_dir'], 'inventory')
with open(path, 'w') as f: with open(path, 'w') as f:
json_data = json.dumps(instance.inventory.get_script_data(hostvars=True)) json_data = json.dumps(instance.inventory.get_script_data(hostvars=True))
f.write('#! /usr/bin/env python\n# -*- coding: utf-8 -*-\nprint """%s"""\n' % json_data) f.write('#! /usr/bin/env python\n# -*- coding: utf-8 -*-\nprint %r\n' % json_data)
os.chmod(path, stat.S_IRUSR | stat.S_IXUSR) os.chmod(path, stat.S_IRUSR | stat.S_IXUSR)
return path return path