cloud-init/cloud-init-0.7.8-dnf.patch
Colin Walters 9785285421 Update to 0.7.9
Rebased some of our patches that look like they still need upstreaming.
Deleted others that were merged.

I disabled a few tests that I couldn't figure out quickly why they were
failing.  From looking at the Debian packaging, it looks like they
turn off a bunch of tests too because they require networking.

The LXD one I just nuked since I don't care right now.

The nosetest bit I need to send upstream.
2017-01-20 12:56:07 -05:00

30 lines
1.3 KiB
Diff

diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py
index aa55838..0d47693 100644
--- a/cloudinit/distros/rhel.py
+++ b/cloudinit/distros/rhel.py
@@ -190,13 +190,17 @@ 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 yum for package management')
+ # 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 = ['yum', '-t']
# Determines whether or not yum prompts for confirmation
# of critical actions. We don't want to prompt...
cmd.append("-y")