Update pip module to support Red Hat distros.

Adds a new pip::params module where we set parameters based on
the operating system.

Updates the pip::init module so that it makes use of distro specific
parameters.

Also, includes a change to pip::init so that a soft link is
created for /usr/bin/pip (pointing to /usr/bin/pip-python). This
is required in order for the Puppet pip provider to work on Red Hat
distributions. Seems like we should push a fix into Puppet for this
as well but having this live here for now seems reasonable.

Change-Id: Ifee6bc42fabcf65ee1241ffac38f3bead7335be1
Reviewed-on: https://review.openstack.org/18904
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Dan Prince 2013-01-03 13:34:07 -05:00 committed by Jenkins
parent b87063de9e
commit 2a7c4b3d83
2 changed files with 34 additions and 3 deletions

View File

@ -1,12 +1,24 @@
# Class: pip
#
class pip {
package { 'python-all-dev':
include pip::params
package { $::pip::params::python_devel_package:
ensure => present,
}
package { 'python-pip':
package { $::pip::params::python_pip_package:
ensure => present,
require => Package['python-all-dev'],
require => Package[$::pip::params::python_devel_package]
}
if ($::operatingsystem == 'Redhat' or $::operatingsystem == 'Fedora') {
file { '/usr/bin/pip':
ensure => 'link',
target => '/usr/bin/pip-python',
}
}
}

19
manifests/params.pp Normal file
View File

@ -0,0 +1,19 @@
# Class: pip::params
#
# This class holds parameters that need to be
# accessed by other classes.
class pip::params {
case $::osfamily {
'Fedora', 'Redhat': {
$python_devel_package = 'python-devel'
$python_pip_package = 'python-pip'
}
'Debian', 'Ubuntu': {
$python_devel_package = 'python-all-dev'
$python_pip_package = 'python-pip'
}
default: {
fail("Unsupported osfamily: ${::osfamily} The 'pip' module only supports osfamily Fedora, Redhat, Debian, or Ubuntu.")
}
}
}