From 4f23f0bec10b8d311a06ef0adeaf8ebe2bd023e9 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 2 Jun 2019 13:08:44 +0100 Subject: [PATCH] issue #590: update comment to indicate the hack is permanent --- ansible_mitogen/runner.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ansible_mitogen/runner.py b/ansible_mitogen/runner.py index a8dae8b1..8dbddadd 100644 --- a/ansible_mitogen/runner.py +++ b/ansible_mitogen/runner.py @@ -763,7 +763,16 @@ class NewStyleRunner(ScriptRunner): try: mitogen.core.import_module(fullname) except ImportError: - # TODO: this is a huge hack to work around issue #590. + # #590: Ansible 2.8 module_utils.distro is a package that + # replaces itself in sys.modules with a non-package during + # import. Prior to replacement, it is a real package containing + # a '_distro' submodule which is used on 2.x. Given a 2.x + # controller and 3.x target, the import hook never needs to run + # again before this replacement occurs, and 'distro' is + # replaced with a module from the stdlib. In this case as this + # loop progresses to the next entry and attempts to preload + # 'distro._distro', the import mechanism will fail. So here we + # silently ignore any failure for it. if fullname != 'ansible.module_utils.distro._distro': raise