From 24aea7045b1422e8351870392b5fae0041e1f17d Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Thu, 22 Nov 2012 09:19:59 +0200 Subject: [PATCH] Added source parameter to python::setup::install --- python/manifests/init.pp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/python/manifests/init.pp b/python/manifests/init.pp index 238d6b9..db35d90 100644 --- a/python/manifests/init.pp +++ b/python/manifests/init.pp @@ -30,12 +30,37 @@ class python { # Source directory. # $python: # Python executable name. Defaults to python. +# $source: +# Source path to package archive. # # === Sample usage # -# python::setup::install { "/usr/local/src/moin-1.8.8": } +# python::setup::install { "/usr/local/src/moin-1.8.8": +# source => "puppet:///files/packages/moin-1.8.8.tar.gz", +# } # -define python::setup::install($python="python") { +define python::setup::install($python="python", source="") { + + if $source { + $filename = basename($source) + file { "/usr/local/src/${filename}": + ensure => present, + mode => "0644", + owner => "root", + group => $operatingsystem ? { + "openbsd" => "wheel", + default => "root", + }, + source => $source, + } + util::extract::tar { $name: + ensure => latest, + strip => 1, + source => "/usr/local/src/${filename}", + require => File["/usr/local/src/${filename}"], + before => Exec["python-setup-install-${name}"], + } + } exec { "python-setup-install-${name}": path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin",