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
yum module properly check for None config_file #46641
yum module properly check for None config_file #46641
Conversation
@maxamillion: thank you for submitting this pull-request ! cc @Akasurde @berenddeschouwer @kustodian @verm666 |
@maxamillion : thanks for finding and correcting this. Per your comment in #46603 (comment):
There are currently zero tests that exercise the Would it be appropriate to also add an integration test that demonstrates failure before this PR, and success after this PR? |
I'm thinking something similar to the test you've committed at |
@@ -1306,7 +1306,7 @@ def ensure(self, repoq): | |||
if self.conf_file and os.path.exists(self.conf_file): | |||
self.yum_basecmd += ['-c', self.conf_file] | |||
|
|||
if repoq: | |||
if repoq and self.conf_file and os.path.exists(self.conf_file): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nitpick but the same conditional self.conf_file and os.path.exists(self.conf_file)
is a couple of lines above, why not just indent the original conditional if repoq
there:
if self.conf_file and os.path.exists(self.conf_file):
self.yum_basecmd += ['-c', self.conf_file]
if repoq:
repoq += ['-c', self.conf_file]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly can't believe I didn't think of that. Will update, thanks.
Signed-off-by: Adam Miller <admiller@redhat.com>
c815343
to
10ac23e
Compare
@tamsky you make a good point and I'll definitely add an integration test but I thought it was weird that you were running into that issue without passing a config file (as per the example you provided) and passing a config file did in fact work around the issue so our tests wouldn't have caught it anyways. |
@@ -135,6 +145,15 @@ | |||
that: | |||
- "not yum_result is changed" | |||
|
|||
- name: install sos with state latest idempotence with config file param | |||
yum: name=sos state=latest | |||
register: yum_result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is
config_file: /etc/yum.conf
missing from this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tamsky it shouldn't be since that's the default one in the container instance as it executes in shippable, I'm just passing it to exercise that arg passing but I realized that because of a change in Ansible 2.7 I need to conditionalize it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tamsky I'm a doof, it absolutely is. Sorry, I misunderstood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There remains an apparent mismatch between:
this test's name:
name: install sos with state latest idempotence with config file param
which includes the string "with config file param",
vs
this test's content, which lacks a config_file
param
yum: name=sos state=latest
In the previous test being added, in this PR, back at L113... the test name matches the test content:
- name: install sos with state latest in check mode with config file param
yum: name=sos state=latest conf_file=/etc/yum.conf
Would it be appropriate to update the second test's name:
(on line 147) so that the test content matches the test name?
Or... am I confused about all this?
Any fixes, please backport to stable-2.7 as well.
Thanks.
CI failure in integration tests: https://app.shippable.com/github/ansible/ansible/runs/87492/37/console |
21d1941
to
ee72c62
Compare
Signed-off-by: Adam Miller <admiller@redhat.com>
ee72c62
to
1db261c
Compare
@maxamillion please backport this to 2.7 once merged. |
rebuild_merge |
bot_status |
* yum module properly check for None config_file * add conf_file test cases to yum integration tests Signed-off-by: Adam Miller <admiller@redhat.com> (cherry picked from commit fb6e91b)
* yum module properly check for None config_file (#46641) * yum module properly check for None config_file * add conf_file test cases to yum integration tests Signed-off-by: Adam Miller <admiller@redhat.com> (cherry picked from commit fb6e91b) * add changelog for 2.7 backport Signed-off-by: Adam Miller <admiller@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maxamillion
Sorry, I'm still confused.
@@ -135,6 +145,15 @@ | |||
that: | |||
- "not yum_result is changed" | |||
|
|||
- name: install sos with state latest idempotence with config file param | |||
yum: name=sos state=latest | |||
register: yum_result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There remains an apparent mismatch between:
this test's name:
name: install sos with state latest idempotence with config file param
which includes the string "with config file param",
vs
this test's content, which lacks a config_file
param
yum: name=sos state=latest
In the previous test being added, in this PR, back at L113... the test name matches the test content:
- name: install sos with state latest in check mode with config file param
yum: name=sos state=latest conf_file=/etc/yum.conf
Would it be appropriate to update the second test's name:
(on line 147) so that the test content matches the test name?
Or... am I confused about all this?
Any fixes, please backport to stable-2.7 as well.
Thanks.
* yum module properly check for None config_file * add conf_file test cases to yum integration tests Signed-off-by: Adam Miller <admiller@redhat.com>
Signed-off-by: Adam Miller admiller@redhat.com
SUMMARY
Fixes #46485
Fixes #46603
ISSUE TYPE
COMPONENT NAME
yum
ANSIBLE VERSION