2017-01-20 17:56:07 +00:00
|
|
|
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):
|
2015-02-20 02:14:45 +00:00
|
|
|
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'):
|
2017-01-20 17:56:07 +00:00
|
|
|
+ LOG.debug('Using dnf for package management')
|
2015-02-20 02:14:45 +00:00
|
|
|
+ cmd = ['dnf']
|
|
|
|
+ else:
|
2017-01-20 17:56:07 +00:00
|
|
|
+ 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.
|
2015-02-20 02:14:45 +00:00
|
|
|
+ cmd = ['yum', '-t']
|
|
|
|
# Determines whether or not yum prompts for confirmation
|
|
|
|
# of critical actions. We don't want to prompt...
|
|
|
|
cmd.append("-y")
|