From 863b5e2e8e45de639596a4639ae1376cd157a77c Mon Sep 17 00:00:00 2001 From: Chris Church Date: Wed, 1 Nov 2017 12:59:49 -0400 Subject: [PATCH] Output repr() of JSON in temporary inventory script to prevent Python from devouring escape sequences. --- awx/main/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index d740f88d4b..c9f768e8a8 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -680,7 +680,7 @@ class BaseTask(LogErrorsTask): path = os.path.join(kwargs['private_data_dir'], 'inventory') with open(path, 'w') as f: 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) return path