Groups
Conversations
All groups and messages
Send feedback to Google
Help
Sign in
Groups
Ansible Development
Conversations
About
Cannot import customered module in module_utils in rhel8
10 views
Skip to first unread message
jianhan MA
unread,
Nov 1, 2021, 5:19:48 AM
11/1/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Link
Report message as abuse
Sign in to report message as abuse
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Development
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:
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)]
Reply all
Reply to author
Forward
0 new messages