Some amazon.aws modules fail on relative import error #896
Labels
affects-0.3
Issues related to 0.3.X Mitogen releases
bug
Code feature that hinders desired execution outcome
I first noticed this issue with the amazon.aws.ec2_tag module:
Module error with line-breaks replaced for readability:
The same module/task runs successfully without Mitogen. In compiling data for this bug I found that the amazon.aws.ec2_tag_info module also exhibits this behavior, but other modules in the collection which follow the same pattern of importing
AnsibleAWSModule
from the same relative path (from ..module_utils.core
) work just fine, and we use several of them:The only common pattern I can see in most/all of these working modules is that they have this specific additional import before
AnsibleAWSModule
:Manually adding this line to the amazon.aws.ec2_tag module above the
AnsibleAWSModule
relative import (i.e., here) seems to resolve the issue by way of triggering additional imports from the collection and/or using a different Mitogen planner (as observed in verbose logging), but as the module works fine without Mitogen, and that module doesn't actually needcamel_dict_to_snake_dict
, I'm starting the "bug train" here. I'll attach verbose output from the task itself with and without the "patch" to the amazon.aws.ec2_tag module.No.
module_utils
loaded?No.
Yes (master and stable branches, and latest 0.3.2 release).
Not really, only as mentioned above the additional import which seems to trigger some additional imports from the collection which aren't loaded otherwise and the use of a different planner.
Amazon Linux 2 (stock image from AWS; no modifications); running against localhost
Python 3.8.5 (default, Feb 18 2021, 01:24:20) [GCC 7.3.1 20180712 (Red Hat 7.3.1-12)] on linux
Example playbook:
Example ansible.cfg:
Ansible verbose (
-vvv
) output for task using amazon.aws.ec2_tag module:ec2_tag_broken.log
Ansible verbose (
-vvv
) output with "patched" amazon.aws.ec2_tag module:ec2_tag_working.log
The text was updated successfully, but these errors were encountered: