Repository navigation
Import dnf only if importing yum fails - #5299
Conversation
|
This is basically saying that "if we have yum" use yum and don't try to import dnf. In Fedora I guess you will have both installed, but yum will be just yelling at you to use dnf instead. Problem is that you can have dnf python module installed but not the '/usr/bin/dnf' binary, which is the case we trying to solve here (I guess). In that case, we succeed importing yum, then we succeed importing dnf and set the package manager to dnf. Afterwards when ansible decide which pkg manager to use, it picks dnf, which is not installed as binary and fail. So to fix this:
just my .40 cents :) |
rhcarvalho
left a comment
There was a problem hiding this comment.
What is the symptom this PR is trying to address?
I followed the original description to look at https://storage.googleapis.com/origin-ci-test/pr-logs/pull/16136/test_pull_request_origin_extended_conformance_install_update/5392/artifacts/junit_01.xml, and all I see is a failure that misses an important part of the message:
...
<testcase name="[localhost] openshift_health_check" time="336.609850">
<failure message="One or more checks failed" type="failure"/>
</testcase>
...
Is it missing the list of failed checks and reason.
Where could we add more context to that message? (the per-check information is accessible from the checks key of the result hash)
| try: | ||
| # We need to check whether the dnf binary is installed, since the | ||
| # import of dnf module won't fail even if the dnf binary is missing | ||
| subprocess.call(["dnf"]) |
There was a problem hiding this comment.
Both ansible/modules/packaging/os/yum.py and ansible/modules/packaging/os/dnf.py use the Python libraries to interact with the package manager, and not their command line binaries.
|
@sosiouxme FYI |
The consequence of this seems to be that we are not able to check whether docker package is installed or not (it is installed but we can't find it). @jhadvig made a test job with this fix and it seems to fix this problem. This is currently blocking all merges in origin, we can make a better solution later, but we need to unblock the merge for now. |
|
looks like you failed linting. |
|
@deads2k updated |
|
[test] maybe? |
|
aos-ci-test |
|
yum mirror flake |
|
[test] |
|
aos-ci-test |
|
@stevekuznetsov PR updated based on our discussion. Now we shall use dnf only if importing yum will fail. |
|
[test] |
|
Whether dnf or yum imports is probably not the best test of which is in use. Probably worthwhile asking "what would ansible do?" but we actually don't have to... ansible tells us with the Though I'm not opposed to just merging whatever unblocks the queue for the short term. |
| except ImportError as err: | ||
| DNF_IMPORT_EXCEPTION = err | ||
|
|
||
| # Import and use dnf only if yum is missing |
There was a problem hiding this comment.
Hmm, this could go for now, but long term we might want to do the same as the package action plugin that dispatches to the yum or dnf module, and use the ansible_pkg_mgr fact:
Since modules don't have access to any of Ansible's internals, we'd pass in as an arg either yum or dnf from the check in package_availability.py.
There was a problem hiding this comment.
I did not mean to leave the conditional in. Should try to import both regardless, and use the one indicated by ansible_pkg_mgr.
|
[test] |
|
This is a proposed fix for openshift/origin#16143 for which we don't yet understand root cause. |
|
[test] |
|
I humbly submit an added commit to hopefully bring a little more sanity to this check. |
|
aos-ci-test |
|
[test] |
Tweaks to the logic around using yum vs dnf; now uses ansible_pkg_mgr to determine which is in effect for a host. Also, extended the yum logic to check installed packages in addition to available packages in the aos_version module so that disconnected installs and others with weird repo configs need not disable the package_version check.
|
aos-ci-test |
|
Evaluated for openshift ansible test up to 8e51499 |
|
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_openshift_ansible/609/) (Base Commit: 89c5814) (PR Branch Commit: 8e51499) |
|
continuous-integration/openshift-jenkins/test FAILURE (
https://ci.openshift.redhat.com/jenkins/job/test_pull_
request_openshift_ansible/609/)
That's just because the aos-ci-test results aren't in yet. Everything else
succeeded.
|
|
when those come in i'll merge manually
…On Wed, Sep 6, 2017 at 11:52 AM, Luke Meyer ***@***.***> wrote:
> continuous-integration/openshift-jenkins/test FAILURE (
> https://ci.openshift.redhat.com/jenkins/job/test_pull_
> request_openshift_ansible/609/)
>
>
That's just because the aos-ci-test results aren't in yet. Everything else
succeeded.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5299 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC8Iep73fpduRTCNto3ZNMJ90Qu7cBTks5sfr-2gaJpZM4PMqSJ>
.
|
We should try to import
dnfonly if importingyumfails. Part of the issue also was that importingdnfdidn't failed even though dnf wasn't installed on the system.Change is tested on this job
@mfojtik @sdodson @stevekuznetsov @jupierce fyi