Merge lp:~harlowja/cloud-init/cloud-init-fix-dnf into lp:~cloud-init-dev/cloud-init/trunk

Proposed by Joshua Harlow
Status: Merged
Merge reported by: Scott Moser
Merged at revision: not available
Proposed branch: lp:~harlowja/cloud-init/cloud-init-fix-dnf
Merge into: lp:~cloud-init-dev/cloud-init/trunk
Diff against target: 33 lines (+16/-8)
1 file modified
cloudinit/distros/rhel.py (+16/-8)
To merge this branch: bzr merge lp:~harlowja/cloud-init/cloud-init-fix-dnf
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
cloud-init Commiters Pending
Review via email: mp+298851@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) :
Revision history for this message
Joshua Harlow (harlowja) :
1249. By Joshua Harlow

Use util.which and always use dnf if it is around

1250. By Joshua Harlow

The os import is no longer needed

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

Hello,
Thank you for taking the time to contribute to cloud-init. Cloud-init has moved its revision control system to git. As a result, we are marking all bzr merge proposals as 'rejected'. If you would like to re-submit this proposal for review, please do so by following the current HACKING documentation at http://cloudinit.readthedocs.io/en/latest/topics/hacking.html .

I think this is actually already merged at
https://git.launchpad.net/cloud-init/commit/?id=a3daf184fd4

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cloudinit/distros/rhel.py'
2--- cloudinit/distros/rhel.py 2016-06-15 23:11:24 +0000
3+++ cloudinit/distros/rhel.py 2016-07-13 00:25:38 +0000
4@@ -201,14 +201,22 @@
5 if pkgs is None:
6 pkgs = []
7
8- cmd = ['yum']
9- # If enabled, then yum will be tolerant of errors on the command line
10- # with regard to packages.
11- # For example: if you request to install foo, bar and baz and baz is
12- # installed; yum won't error out complaining that baz is already
13- # installed.
14- cmd.append("-t")
15- # Determines whether or not yum prompts for confirmation
16+ dnf_bin = util.which("dnf")
17+ if dnf_bin:
18+ LOG.debug('Using DNF for package management')
19+ cmd = [dnf_bin]
20+ else:
21+ LOG.debug('Using YUM for package management')
22+ cmd = ['yum']
23+ # If enabled, then yum will be tolerant of errors on the command
24+ # line with regard to packages.
25+ #
26+ # For example: if you request to install foo, bar and baz and
27+ # baz is installed; yum won't error out complaining that baz
28+ # is already installed.
29+ cmd.append("-t")
30+
31+ # Determines whether or not yum/dnf prompts for confirmation
32 # of critical actions. We don't want to prompt...
33 cmd.append("-y")
34