-
Notifications
You must be signed in to change notification settings - Fork 23.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport/2.8/63713 yum single yum base instantiation 53286 non existe…
…nt repos (#65575) * yum - only instantiate YumBase once (#63713) * yum - only instantiate YumBase once Previously, this code was re-instantiating the `YumBase` object many times which is unnecessary and slow. However, we must do it twice in the `state: absent` case because the `yumSack` and `rpmSack` data of the previously instantiated object becomes invalid and is no longer useful post transaction when we verify that the package removal did in fact take place. Also, this patch removes the repetitive re-processing of enable/disable of repos in various places. Here's a display of the speed increase against a RHEL7 host: ```yaml - hosts: rhel7 remote_user: root tasks: - name: Install generic packages yum: state: present name: - iptraf-ng - screen - erlang - name: Remove generic packages yum: state: absent name: - iptraf-ng - screen - erlang ``` Before this patch: ``` real 0m52.728s user 0m5.645s sys 0m0.482s ``` After this patch: ``` real 0m17.139s user 0m3.238s sys 0m0.277s ``` Fixes #63588 Fixes #63551 Signed-off-by: Adam Miller <admiller@redhat.com> * add changelog Signed-off-by: Adam Miller <admiller@redhat.com> * YUM - handle enable of non-existent repo (#53286)
- Loading branch information
1 parent
41bddb6
commit 3edff5d
Showing
4 changed files
with
142 additions
and
92 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
changelogs/fragments/63551-yum-single-YumBase-instantiation.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bugfixes: | ||
- yum - performance bugfix, the YumBase object was being instantiated | ||
multiple times unnecessarily, which lead to considerable overhead when | ||
operating against large sets of packages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
bugfixes: | ||
- "yum - gracefully handle failure case of enabling a non existent repo, as the yum cli does (Fixes https://github.com/ansible/ansible/issues/52582)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3edff5d
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.
Latest Ansible 2.8 (2.8.8) has a bug in yum when disabling all repos ('*') and enabling only some (eg: 'base,updates') and this commit seems to be the culprit (version 2.8.7 is immune).
In yum.py, instruction in line 494 (see above) should come after instruction in line 497.
Latest Ansible 2.9 corrects this: should a backport to 2.8.x be done?