-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
#19587 add yum skip-broken #21475
#19587 add yum skip-broken #21475
Conversation
PNTSYSOPS-1901 - internal reference Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>
this WIP need to test this , will bump the PR once this is ready for review |
things at line 646 look ugly .. trying to make them look a bit more human readble though the entire approach should be rewriten PNTSYSOPS-1901 - internal reference Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>
i hope the thingy will not complain about this 3 vars , i was thining to cover those in a separte MR
|
imho this is ready for review, there are this 2 issues not sure if i should remove them within this MR or as a separate one.
e.g. IMHO this entire conditional makes no use, it's either redundant or became redundant during some change.
same goes here this peace can be rewrote
might be end-up like this
|
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 couple of comments
@@ -988,10 +1011,13 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, in | |||
for w in will_update: | |||
if w.startswith('@'): | |||
to_update.append((w, None)) | |||
msg = '%s will be updated' % w | |||
res['msg'] += '%s will be updated' % w |
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.
not even sure why that previous msg = '%s will be updated' % w was there, just tried to 'guess'
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.
Judging from the other things in this conditional, it probably should be appended to to_update?
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.
in this case I think it should be removed at all cause to_updated get's updated on previous line
@@ -1095,7 +1125,7 @@ def ensure(module, state, pkgs, conf_file, enablerepo, disablerepo, | |||
for i in new_repos: | |||
if not i in current_repos: | |||
rid = my.repos.getRepo(i) | |||
a = rid.repoXML.repoid | |||
a = rid.repoXML.repoid ## if no one complains remove this on next MR |
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.
this is one of the var complaints, the var is assigned but not really used.
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.
Check the yum code for sideeffects (repoid might be a property and referencing it might cause some action to happen). If this is a simply attribute rather than something producing side-effects, feel free to get rid of 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.
3 import yum
4 from json import dumps
5
6 instance = yum.YumBase()
7 print "###################################"
8 for repo in instance.repos.listEnabled():
9 print type(repo.repoXML.repoid)
says
###################################
Loaded plugins: product-id
Repo rhel-7-server-satellite-tools-6.2-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/7092233073807600698-key.pem
Repo rhel-server-rhscl-7-eus-source-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/7092233073807600698-key.pem
Repo rhel-7-server-extras-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/7092233073807600698-key.pem
Repo rhel-7-server-optional-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/7092233073807600698-key.pem
Repo rhel-7-server-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/7092233073807600698-key.pem
Repo rhel-7-fast-datapath-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/7092233073807600698-key.pem
Repo rhel-7-server-tus-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/7092233073807600698-key.pem
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
<type 'str'>
[vmindru@vmutil python]$
so i guess it's a string.
~
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.
will remove that, it's basically repo name string.
stuff, | ||
conf_file, | ||
qf=qf, | ||
installroot=installroot)) if p.strip() ] |
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.
This is horrible formatting ;-) If you want to break this up, make logical divisions more like this:
return [ pkg_to_dict(p) for p in sorted(
is_installed(module, repoq, stuff, conf_file, qf=is_installed_qf, installroot=installroot) +
is_available(module, repoq, stuff, conf_file, qf=qf, installroot=installroot))
if p.strip() ]
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.
ack, will do was not sure how do format this 100 organizations 100 formatting styles :-D
# list=available | ||
# list=repos | ||
# list=pkgspec | ||
|
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.
Leave this, at least for now. there's no other listing of the two types of commands (and the arguments that list takes aren't even i nthe documentatoin :-(
@@ -1058,6 +1084,10 @@ def ensure(module, state, pkgs, conf_file, enablerepo, disablerepo, | |||
|
|||
dis_repos =[] | |||
en_repos = [] | |||
|
|||
if skip_broken: | |||
yum_basecmd.extend(['--skip-broken']) |
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 skip-broken allowed for all of the commands that we run? (I've used it with yum update but never with yum remove or yum install).
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.
Yep https://linux.die.net/man/8/yum --skip-broken is in the general section meaning it can be added to any other action.
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.
we use it quite often during Maintenance windows and mass server updates, we don't want to waste time to solve problems on failed machines, we just --skip-update and later follow-up what are the deps issues.
relates to: revert comment deletion ansible#21475 (comment) relates to: remove irelevant var ansible#21475 (comment) relates to: reformat ansible#21475 (comment) Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>
relates to: ansible#21475 (comment) Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>
can we ignore the CI test failure
I presume it's caused by, and i really don't want to change that part of code
EDIT: seems this failure actually has to do with the fact that this is listed in test/sanity/pep8/legacy-files.txt if removed tests pass ok |
Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>
@vmindru Since you've fixed the PEP 8 issues that currently exist in the file, you need to remove the file from |
for i in new_repos: | ||
if not i in current_repos: | ||
rid = my.repos.getRepo(i) | ||
a = rid.repoXML.repoid |
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 think accessing repoXML has a side effect. This is in the yum source (yumRepo.py):
def _loadRepoXML(self, text=None):
"""retrieve/check/read in repomd.xml from the repository"""
try:
return self._groupLoadRepoXML(text, self._mdpolicy2mdtypes())
except KeyboardInterrupt:
self._revertOldRepoXML() # Undo metadata cookie?
raise
raise Errors.RepoError, 'Bad loadRepoXML policy (for %s): %s' % (self.ui_id, self.mdpolicy)
def _getRepoXML(self):
if self._repoXML:
return self._repoXML
self._loadRepoXML(text=self.ui_id)
return self._repoXML
repoXML = property(fget=lambda self: self._getRepoXML(),
fset=lambda self, val: setattr(self, "_repoXML", val),
fdel=lambda self: setattr(self, "_repoXML", None))
So we probably need to keep this. Should add a comment to say why it's there as well.
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.
Note: If this is causing the pep8 test to complain, it would be a valid place to use the # nopep8 comment (along with the comment explaining why we have to do this).
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.
this has been reverted, #21619 has been created not to forget to tackle this issue. I decided to take care of this issue in a separate PR to keep things less polluted.
This is close. In addition to removing from the pep8 skip file I only see one problem that needs to be addressed. |
Relates to: ansible#21475 (review) Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>
w00t! :) all tests have passed LOL so nice to see green color all other the place. Now need final review and then I can tackle this module further under #21619 |
Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>
Squashed and merged to devel (for 2.3.0 release). Thanks vmindru! |
ISSUE TYPE
COMPONENT NAME
modules/packaging/os/yum.py
ANSIBLE VERSION
targeting 2.3 i guess
SUMMARY
adding skip_broken option, --skip-broken as per yum man is a general option meaning it can be added all other the place, therefore, adding it into the yum_basecmd
bonus: did some pep8 refactor
test-module pastebin http://pastebin.com/mgCmcVdq