diff --git a/python/manifests/init.pp b/python/manifests/init.pp index 474265a..c933810 100644 --- a/python/manifests/init.pp +++ b/python/manifests/init.pp @@ -2,19 +2,19 @@ # class python { - package { "python": + package { 'python': ensure => installed, notify => $::operatingsystem ? { - "openbsd" => Exec["python-links"], + 'openbsd' => Exec['python-links'], default => undef, }, } - exec { "python-links": - path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin", - command => "pkg_info python | egrep '^[ ]*ln -sf' | sh", - user => "root", - group => "wheel", + exec { 'python-links': + path => '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin', + command => 'pkg_info python | egrep "^[ ]*ln -sf" | sh', + user => 'root', + group => 'wheel', refreshonly => true, } @@ -25,8 +25,8 @@ class python { # class python::python26 { - if $::operatingsystem in ["CentOS","RedHat"] and versioncmp($::operatingsystemrelease, "6") < 0 { - package { "python26": + if $::operatingsystem in ['CentOS','RedHat'] and versioncmp($::operatingsystemrelease, '6') < 0 { + package { 'python26': ensure => installed, } } @@ -38,13 +38,20 @@ class python::python26 { # class python::m2crypto { - package { "m2crypto": - ensure => installed, - name => $::operatingsystem ? { - "debian" => "python-m2crypto", - "ubuntu" => "python-m2crypto", - default => "m2crypto", + case $::operatingsystem { + 'debian','ubuntu': { + $package = 'python-m2crypto' } + 'openbsd': { + $package = 'py-M2Crypto' + } + default: { + $package = 'm2crypto' + } + } + + package { $package: + ensure => installed, } } @@ -63,12 +70,12 @@ class python::m2crypto { # # === Sample usage # -# python::setup::install { "/usr/local/src/moin-1.8.8": -# source => "puppet:///files/packages/moin-1.8.8.tar.gz", +# 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", + $python='python', $source=undef, ) { @@ -76,17 +83,17 @@ define python::setup::install( $filename = basename($source) file { "/usr/local/src/${filename}": ensure => present, - mode => "0644", - owner => "root", + mode => '0644', + owner => 'root', group => $::operatingsystem ? { - "openbsd" => "wheel", - default => "root", + 'openbsd' => 'wheel', + default => 'root', }, source => $source, } util::extract::tar { $name: ensure => latest, - strip => "1", + strip => '1', source => "/usr/local/src/${filename}", require => File["/usr/local/src/${filename}"], before => Exec["python-setup-install-${name}"], @@ -94,7 +101,7 @@ define python::setup::install( } exec { "python-setup-install-${name}": - path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin", + path => '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin', cwd => $name, command => "/bin/sh -c 'umask 022; ${python} setup.py install && mkdir -p build'", creates => "${name}/build", @@ -117,7 +124,7 @@ define python::setup::install( define python::compile() { exec { "python -c \"import py_compile; py_compile.compile('${name}')\"": - path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin", + path => '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin', onlyif => "test '${name}' -nt '${name}c'", }