-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix "'ansible' ModuleNotFoundError" in Disaster Recovery scripts #503
Conversation
needs changelog entry, other than that lgtm |
@barpavel we may have 4.2 (or more probably 4.3) clusters that are based on EL7, where we used Python 2, wouldn't the DR be affected? |
This part of the commit message is not helpful and best removed:
The issue seems to be using old python 2 compatibility code that is not needed But what worries me is:
It can mean that you are using the wrong python version, which is a bigger problem. |
Will do. |
The real issue seems to be here: If this code should use ansible, it should use python3.8. |
In that case (if we still use Python2) I can change the |
Yes, strange, I see a lot of usages |
I see all DR files use: |
The important question is if this script depends on ansible python package, or is is a standalone tool using other command line tools. In the first case you want to use python3.8 since this is where ansible stuff is installed. In the second case using python3 is fine. |
So it's not entirely true. AFAIR iif there is a python script executed from ansible playbook, then it's executed by the python installed on the target host and not the control host (the host where you execute the playbook from). Of course you can force which python version you want to use using
Just be aware that we are still supporting both EL7 and EL8 hosts (and hopefully soon also EL9 in oVirt), so you should choose only installed python version for each OS version (unless you want to install additional packages of course) @mnecas Am I right? |
I must admit that after all the comments from so many people - and I'm really thankful for your comments - I'm totally confused and have no clue what is the problem and what is the right solution and why it worked in 4.4 and stopped working :( @ahadas if we should support Python2, then probably need to keep on using @nirs I see that on QE machines @mnecas @mwperina maybe Martin Perina already provided the answer, but I didn't understand it, sorry then. I see there are lots of files having And in regard to what @nirs wrote |
I don't think we can support python 2 at this point. Users on RHEL 7 need to use the ovirt-dr script distributed for RHEL 7. Users on RHEL 8 can use only python 3. The ovirt-dr script is not run by ansible - it runs ansible playbooks, so we cannot control Using the built in input function is the right way. Lets focus on this fix now and leave |
0cc9a3e
to
23f3392
Compare
23f3392
to
a548fac
Compare
Removed the redundant description from both the commit and PR messages. |
a548fac
to
5eb74af
Compare
Done. Added the changelog entry according to examples from other PRs. |
5eb74af
to
d3687b7
Compare
/ost |
I'm not sure if we should keep it or not because I don't remember if we execute things on the hosts as part of the DR - my point was that if we execute things on the hosts then we should take into consideration that some of the hosts have python 2, and then if we drop support for python 2 it means those clusters couldn't take part in the process |
The DR scripts connect to
Also providing SD details, cluster information, etc. But AFAIR we don't run directly on hosts.
In short, all commands are sent to |
@barpavel ok, great, thanks for checking |
d3687b7
to
3472d2a
Compare
When executing any Disaster Recovery script, the following error is received: [root@storage-ge-13 files]# ./ovirt-dr generate Traceback (most recent call last): File "./ovirt-dr", line 15, in <module> import fail_back File "/usr/share/ansible/collections/ansible_collections/redhat/rhv/roles/disaster_recovery/files/fail_back.py", line 14, in <module> from ansible.module_utils.six.moves import input ModuleNotFoundError: No module named 'ansible' The reason for that is the following import statement: from ansible.module_utils.six.moves import input There is no need to use "six" library at all since Python2 is deprecated! All "import"s of "six" module can be deleted now and the builtin Python3 "input()" function will be used instead. Signed-off-by: Pavel Bar <pbar@redhat.com> Bug-Url: https://bugzilla.redhat.com/2090264
3472d2a
to
47b071e
Compare
/ost |
…Virt#503) When executing any Disaster Recovery script, the following error is received: [root@storage-ge-13 files]# ./ovirt-dr generate Traceback (most recent call last): File "./ovirt-dr", line 15, in <module> import fail_back File "/usr/share/ansible/collections/ansible_collections/redhat/rhv/roles/disaster_recovery/files/fail_back.py", line 14, in <module> from ansible.module_utils.six.moves import input ModuleNotFoundError: No module named 'ansible' The reason for that is the following import statement: from ansible.module_utils.six.moves import input There is no need to use "six" library at all since Python2 is deprecated! All "import"s of "six" module can be deleted now and the builtin Python3 "input()" function will be used instead. Signed-off-by: Pavel Bar <pbar@redhat.com> Bug-Url: https://bugzilla.redhat.com/2090264 Co-authored-by: Martin Nečas <necas.marty@gmail.com>
When executing any Disaster Recovery script, the following error is received:
The reason for that is the following
import
statement:from ansible.module_utils.six.moves import input
.There is no need to use "
six
" library at all since Python2 is deprecated!All "
import
"s of "six
" module can be deleted now and the builtin Python3 "input()
" function will be used instead.Bug-Url: https://bugzilla.redhat.com/2090264