diff --git a/manifests/init.pp b/manifests/init.pp index 17108bd..461e29c 100644 --- a/manifests/init.pp +++ b/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/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..5acb02c --- /dev/null +++ b/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.") + } + } +}