Joshua Harlow has proposed merging lp:~harlowja/cloud-init/cloud-init-fix-dnf into lp:cloud-init.
Requested reviews: cloud init development team (cloud-init-dev) For more details, see: https://code.launchpad.net/~harlowja/cloud-init/cloud-init-fix-dnf/+merge/298851 Enable usage of DNF for package management DNF is the new YUM replacement so if it exists or if its usage is forced try to use it instead to install packages. -- Your team cloud init development team is requested to review the proposed merge of lp:~harlowja/cloud-init/cloud-init-fix-dnf into lp:cloud-init.
=== modified file 'cloudinit/distros/rhel.py' --- cloudinit/distros/rhel.py 2016-06-15 23:11:24 +0000 +++ cloudinit/distros/rhel.py 2016-07-01 00:07:56 +0000 @@ -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 + from cloudinit import distros from cloudinit import helpers from cloudinit import log as logging @@ -201,14 +203,22 @@ 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") - # Determines whether or not yum prompts for confirmation + if (os.path.isfile('/usr/bin/dnf') or + self._cfg.get('force_dnf', False)): + LOG.debug('Using DNF for package management') + cmd = ['dnf'] + else: + LOG.debug('Using YUM for package management') + 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") + + # Determines whether or not yum/dnf prompts for confirmation # of critical actions. We don't want to prompt... cmd.append("-y")
_______________________________________________ Mailing list: https://launchpad.net/~cloud-init-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp

