From 3e0de9790c16297daf33cb0969246a34eeccc040 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 28 Jul 2018 14:09:21 -0700 Subject: [PATCH] issue #324: fix Python 3 fallout for custom module_utils. Also enable at last one of its tests. --- ansible_mitogen/runner.py | 4 ++-- tests/ansible/ansible.cfg | 2 +- tests/ansible/integration/all.yml | 2 +- tests/ansible/integration/module_utils/all.yml | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ansible_mitogen/runner.py b/ansible_mitogen/runner.py index ca3928b3..86f7b329 100644 --- a/ansible_mitogen/runner.py +++ b/ansible_mitogen/runner.py @@ -264,9 +264,9 @@ class ModuleUtilsImporter(object): mod.__loader__ = self if is_pkg: mod.__path__ = [] - mod.__package__ = fullname + mod.__package__ = str(fullname) else: - mod.__package__ = fullname.rpartition('.')[0] + mod.__package__ = str(fullname.rpartition('.')[0]) exec(code, mod.__dict__) self._loaded.add(fullname) return mod diff --git a/tests/ansible/ansible.cfg b/tests/ansible/ansible.cfg index 7bf849d5..d9224ab7 100644 --- a/tests/ansible/ansible.cfg +++ b/tests/ansible/ansible.cfg @@ -7,7 +7,7 @@ callback_plugins = lib/callback stdout_callback = nice_stdout vars_plugins = lib/vars library = lib/modules -# module_utils = lib/module_utils +module_utils = lib/module_utils retry_files_enabled = False forks = 50 diff --git a/tests/ansible/integration/all.yml b/tests/ansible/integration/all.yml index 264ae716..bf534aed 100644 --- a/tests/ansible/integration/all.yml +++ b/tests/ansible/integration/all.yml @@ -9,7 +9,7 @@ - import_playbook: connection_loader/all.yml - import_playbook: context_service/all.yml - import_playbook: local/all.yml -#- import_playbook: module_utils/all.yml +- import_playbook: module_utils/all.yml - import_playbook: playbook_semantics/all.yml - import_playbook: remote_tmp/all.yml - import_playbook: runner/all.yml diff --git a/tests/ansible/integration/module_utils/all.yml b/tests/ansible/integration/module_utils/all.yml index 920b5d1c..c8b8f2fb 100644 --- a/tests/ansible/integration/module_utils/all.yml +++ b/tests/ansible/integration/module_utils/all.yml @@ -1,6 +1,6 @@ -- import_playbook: from_config_path.yml -- import_playbook: from_config_path_pkg.yml -- import_playbook: adjacent_to_playbook.yml +#- import_playbook: from_config_path.yml +#- import_playbook: from_config_path_pkg.yml +#- import_playbook: adjacent_to_playbook.yml - import_playbook: adjacent_to_role.yml -- import_playbook: overrides_builtin.yml +#- import_playbook: overrides_builtin.yml