090f910
Index: cloud-init-0.7.8/cloudinit/distros/rhel.py
37c3202
===================================================================
090f910
--- cloud-init-0.7.8.orig/cloudinit/distros/rhel.py
090f910
+++ cloud-init-0.7.8/cloudinit/distros/rhel.py
37c3202
@@ -20,6 +20,8 @@
37c3202
 #    You should have received a copy of the GNU General Public License
37c3202
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
37c3202
 
37c3202
+import os.path
37c3202
+
37c3202
 from cloudinit import distros
37c3202
 from cloudinit import helpers
37c3202
 from cloudinit import log as logging
090f910
@@ -201,13 +203,12 @@ 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")
37c3202
+        if os.path.isfile('/usr/bin/dnf'):
37c3202
+            LOG.debug('Using DNF for package management')
37c3202
+            cmd = ['dnf']
37c3202
+        else:
090f910
+            LOG.debug('Using YUM for package management')
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")