Switch to dnf instead of yum when available

https://bugzilla.redhat.com/show_bug.cgi?id=1194451
This commit is contained in:
Garrett Holmstrom 2015-02-19 18:14:45 -08:00
parent 469555be6b
commit 37c3202f99
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,33 @@
Index: cloud-init-0.7.6/cloudinit/distros/rhel.py
===================================================================
--- cloud-init-0.7.6.orig/cloudinit/distros/rhel.py
+++ cloud-init-0.7.6/cloudinit/distros/rhel.py
@@ -20,6 +20,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import os.path
+
from cloudinit import distros
from cloudinit import helpers
from cloudinit import log as logging
@@ -181,13 +183,12 @@ class Distro(distros.Distro):
if pkgs is None:
pkgs = []
- cmd = ['yum']
- # If enabled, then yum will be tolerant of errors on the command line
- # with regard to packages.
- # For example: if you request to install foo, bar and baz and baz is
- # installed; yum won't error out complaining that baz is already
- # installed.
- cmd.append("-t")
+ if os.path.isfile('/usr/bin/dnf'):
+ LOG.debug('Using DNF for package management')
+ cmd = ['dnf']
+ else:
+ LOG.debug('Using DNF for package management')
+ cmd = ['yum', '-t']
# Determines whether or not yum prompts for confirmation
# of critical actions. We don't want to prompt...
cmd.append("-y")

View File

@ -47,6 +47,10 @@ Patch5: cloud-init-0.7.6-network-online.patch
# http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/revision/1050 # http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/revision/1050
Patch6: cloud-init-0.7.6-user-session.patch Patch6: cloud-init-0.7.6-user-session.patch
# Use dnf instead of yum when available
# https://bugzilla.redhat.com/show_bug.cgi?id=1194451
Patch7: cloud-init-0.7.6-dnf.patch
# Deal with noarch -> arch # Deal with noarch -> arch
# https://bugzilla.redhat.com/show_bug.cgi?id=1067089 # https://bugzilla.redhat.com/show_bug.cgi?id=1067089
Obsoletes: cloud-init < 0.7.5-3 Obsoletes: cloud-init < 0.7.5-3
@ -168,6 +172,7 @@ rm -rf $RPM_BUILD_ROOT
- Changed network.target systemd deps to network-online.target [RH:1110731 RH:1112817 RH:1147613] - Changed network.target systemd deps to network-online.target [RH:1110731 RH:1112817 RH:1147613]
- Fixed race condition between cloud-init.service and the login prompt - Fixed race condition between cloud-init.service and the login prompt
- Stopped enabling services in %%post (now done by kickstart) [RH:850058] - Stopped enabling services in %%post (now done by kickstart) [RH:850058]
- Switched to dnf instead of yum when available [RH:1194451]
* Fri Nov 14 2014 Colin Walters <walters@redhat.com> - 0.7.6-2 * Fri Nov 14 2014 Colin Walters <walters@redhat.com> - 0.7.6-2
- New upstream version [RH:974327] - New upstream version [RH:974327]