From a9afb1e19e9cd6c4914a2711327f1cda2f0d26d8 Mon Sep 17 00:00:00 2001 From: Pilou Date: Mon, 20 Nov 2017 08:03:55 +0100 Subject: [PATCH] hacking/test-module: fix Python 3 compatibility (#33069) Exception was: Traceback (most recent call last): File "./hacking/test-module", line 268, in main() File "./hacking/test-module", line 249, in main (modfile, modname, module_style) = boilerplate_module(options.module_path, options.module_args, interpreters, options.check, options.filename) File "./hacking/test-module", line 155, in boilerplate_module if module_style == 'new' and 'ANSIBALLZ_WRAPPER = True' in module_data: TypeError: a bytes-like object is required, not 'str' --- hacking/test-module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hacking/test-module b/hacking/test-module index 5709fb1508..aecb6e9caf 100755 --- a/hacking/test-module +++ b/hacking/test-module @@ -41,7 +41,7 @@ from ansible.parsing.utils.jsonify import jsonify from ansible.parsing.splitter import parse_kv import ansible.executor.module_common as module_common import ansible.constants as C -from ansible.module_utils._text import to_text +from ansible.module_utils._text import to_native, to_text try: import json @@ -152,7 +152,7 @@ def boilerplate_module(modfile, args, interpreters, check, destfile): task_vars=task_vars ) - if module_style == 'new' and 'ANSIBALLZ_WRAPPER = True' in module_data: + if module_style == 'new' and 'ANSIBALLZ_WRAPPER = True' in to_native(module_data): module_style = 'ansiballz' modfile2_path = os.path.expanduser(destfile)