When I try use my own module in rhel8 based on 
https://docs.ansible.com/ansible/latest/dev_guide/developing_module_utilities.html#:~:text=Ansible%20provides%20a%20number%20of%20module%20utilities%2C%20or,Python%20Ansible%20modules%20must%20import%20something%20from%20ansible.module_utils
.
it shows me an error called:
<https://user-images.githubusercontent.com/59634664/139643343-8d20f847-64d4-4915-a485-a23c48d282ad.png>Unable
 
to import sdk_shared(my own function) due to invalid syntax
However it can be worked in rhel7, it seems because rhel8 is using python3 
and rhel7 is using python2.
But the import function should not has difference between python2 and 3, 
could someone give me a suggestion?

Environment:
lib dir: /home/dev/platformx_core_4.4/sdk/library/yum_repo_snapshot.py
module_utils dir: 
/home/dev/platformx_core_4.4/sdk/module_utils/sdk_shared.py
the code in yum_repo_snapshot.py:
from ansible.module_utils.sdk_shared import *

ansible 2.9.25 config file = /etc/ansible/ansible.cfg configured module 
search path = ['/root/.ansible/plugins/modules', 
'/usr/share/ansible/plugins/modules'] ansible python module location = 
/usr/lib/python3.6/site-packages/ansible executable location = 
/usr/bin/ansible python version = 3.6.8 (default, Aug 12 2021, 07:06:15) 
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/6d3e5341-7f14-484a-85de-20462b6e2fa8n%40googlegroups.com.

Reply via email to