From 0bdc3b0cf4f340bc4f672d3a34392f0004529871 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Thu, 3 Jan 2013 13:34:07 -0500 Subject: [PATCH] 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 Reviewed-by: Clark Boylan Reviewed-by: Jeremy Stanley Reviewed-by: James E. Blair Approved: James E. Blair Tested-by: Jenkins --- modules/pip/manifests/init.pp | 18 +++++++++++++++--- modules/pip/manifests/params.pp | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 modules/pip/manifests/params.pp diff --git a/modules/pip/manifests/init.pp b/modules/pip/manifests/init.pp index 17108bd175..461e29c78b 100644 --- a/modules/pip/manifests/init.pp +++ b/modules/pip/manifests/init.pp @@ -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', + } + + } + } diff --git a/modules/pip/manifests/params.pp b/modules/pip/manifests/params.pp new file mode 100644 index 0000000000..5acb02cca5 --- /dev/null +++ b/modules/pip/manifests/params.pp @@ -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.") + } + } +}