7fd3480
Index: cloud-init-0.7.9/cloudinit/distros/rhel.py
7fd3480
===================================================================
7fd3480
--- cloud-init-0.7.9.orig/cloudinit/distros/rhel.py
7fd3480
+++ cloud-init-0.7.9/cloudinit/distros/rhel.py
7fd3480
@@ -190,13 +190,18 @@ class Distro(distros.Distro):
37c3202
         if pkgs is None:
37c3202
             pkgs = []
37c3202
 
37c3202
-        cmd = ['yum']
37c3202
-        # If enabled, then yum will be tolerant of errors on the command line
37c3202
-        # with regard to packages.
37c3202
-        # For example: if you request to install foo, bar and baz and baz is
37c3202
-        # installed; yum won't error out complaining that baz is already
37c3202
-        # installed.
37c3202
-        cmd.append("-t")
7fd3480
+        if util.which('dnf'):
7fd3480
+            LOG.debug('Using DNF for package management')
37c3202
+            cmd = ['dnf']
37c3202
+        else:
7fd3480
+            LOG.debug('Using YUM for package management')
7fd3480
+            # the '-t' argument makes yum tolerant of errors on the command
7fd3480
+            # line with regard to packages.
7fd3480
+            #
7fd3480
+            # For example: if you request to install foo, bar and baz and baz
7fd3480
+            # is installed; yum won't error out complaining that baz is already
Colin Walters 9785285
+            # installed.
37c3202
+            cmd = ['yum', '-t']
37c3202
         # Determines whether or not yum prompts for confirmation
37c3202
         # of critical actions. We don't want to prompt...
37c3202
         cmd.append("-y")