python: Lint fixes, reindent

This commit is contained in:
Ossi Salmi 2016-02-24 10:36:00 +02:00
parent 990dd7e2c6
commit 1fea7f6080

View file

@ -2,21 +2,21 @@
# #
class python { class python {
package { "python": package { "python":
ensure => installed, ensure => installed,
notify => $::operatingsystem ? { notify => $::operatingsystem ? {
"openbsd" => Exec["python-links"], "openbsd" => Exec["python-links"],
default => undef, default => undef,
}, },
} }
exec { "python-links": exec { "python-links":
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",
command => "pkg_info python | egrep '^[ ]*ln -sf' | sh", command => "pkg_info python | egrep '^[ ]*ln -sf' | sh",
user => "root", user => "root",
group => "wheel", group => "wheel",
refreshonly => true, refreshonly => true,
} }
} }
@ -25,11 +25,11 @@ class python {
# #
class python::python26 { class python::python26 {
if $::operatingsystem in ["CentOS","RedHat"] and versioncmp($::operatingsystemrelease, "6") < 0 { if $::operatingsystem in ["CentOS","RedHat"] and versioncmp($::operatingsystemrelease, "6") < 0 {
package { "python26": package { "python26":
ensure => installed, ensure => installed,
}
} }
}
} }
@ -38,14 +38,14 @@ class python::python26 {
# #
class python::m2crypto { class python::m2crypto {
package { "m2crypto": package { "m2crypto":
ensure => installed, ensure => installed,
name => $::operatingsystem ? { name => $::operatingsystem ? {
"debian" => "python-m2crypto", "debian" => "python-m2crypto",
"ubuntu" => "python-m2crypto", "ubuntu" => "python-m2crypto",
default => "m2crypto", default => "m2crypto",
}
} }
}
} }
@ -54,12 +54,12 @@ class python::m2crypto {
# #
# === Parameters # === Parameters
# #
# $name: # $name:
# Source directory. # Source directory.
# $python: # $python:
# Python executable name. Defaults to python. # Python executable name. Defaults to python.
# $source: # $source:
# Source path to package archive. # Source path to package archive.
# #
# === Sample usage # === Sample usage
# #
@ -68,37 +68,37 @@ class python::m2crypto {
# } # }
# #
define python::setup::install( define python::setup::install(
$python="python", $python="python",
$source=undef, $source=undef,
) { ) {
if $source { if $source {
$filename = basename($source) $filename = basename($source)
file { "/usr/local/src/${filename}": file { "/usr/local/src/${filename}":
ensure => present, ensure => present,
mode => "0644", mode => "0644",
owner => "root", owner => "root",
group => $::operatingsystem ? { group => $::operatingsystem ? {
"openbsd" => "wheel", "openbsd" => "wheel",
default => "root", default => "root",
}, },
source => $source, 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}"],
}
} }
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}": 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, cwd => $name,
command => "/bin/sh -c 'umask 022; ${python} setup.py install && mkdir -p build'", command => "/bin/sh -c 'umask 022; ${python} setup.py install && mkdir -p build'",
creates => "${name}/build", creates => "${name}/build",
} }
} }
@ -107,8 +107,8 @@ define python::setup::install(
# #
# === Parameters # === Parameters
# #
# $name: # $name:
# File name to compile. # File name to compile.
# #
# === Sample usage # === Sample usage
# #
@ -116,9 +116,9 @@ define python::setup::install(
# #
define python::compile() { define python::compile() {
exec { "python -c \"import py_compile; py_compile.compile('${name}')\"": 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'", onlyif => "test '${name}' -nt '${name}c'",
} }
} }