Skip to content

Commit

Permalink
Merge pull request #277 from BasLangenberg/feature/pip-path-parameter
Browse files Browse the repository at this point in the history
Add parameter path to pip manifest
  • Loading branch information
Shiva Poudel committed Dec 18, 2015
2 parents 19c6024 + 67bac45 commit c3332b3
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions manifests/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@
# Boolean. If true the package is installed as an editable resource.
#
# [*environment*]
# Additional environment variables required to install the packages.
# Default: none
# Additional environment variables required to install the packages. Default: none
#
# [*timeout*]
# The maximum time in seconds the "pip install" command should take.
# Default: 1800
# The maximum time in seconds the "pip install" command should take. Default: 1800
#
# [*install_args*]
# String. Any additional installation arguments that will be supplied
# when running pip install.
#
# [*uninstall args*]
# [*uninstall_args*]
# String. Any additional arguments that will be supplied when running
# pip uninstall.
#
Expand Down Expand Up @@ -82,10 +80,9 @@
$uninstall_args = '',
$timeout = 1800,
$log_dir = '/tmp',
$path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
) {

$pip_freeze_pkgname = regsubst($pkgname, '_', '-', 'G')
notice("Pip freeze pkgname: ${pip_freeze_pkgname}")
# Parameter validation
if ! $virtualenv {
fail('python::pip: virtualenv parameter must not be empty')
Expand Down Expand Up @@ -139,12 +136,12 @@
}

# Check if searching by explicit version.
if $ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/ { #lint:ignore:80chars
$grep_regex = "^${pip_freeze_pkgname}==${ensure}\$"
if $ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/ {
$grep_regex = "^${pkgname}==${ensure}\$"
} else {
$grep_regex = $pip_freeze_pkgname ? {
/==/ => "^${pip_freeze_pkgname}\$",
default => "^${pip_freeze_pkgname}==",
$grep_regex = $pkgname ? {
/==/ => "^${pkgname}\$",
default => "^${pkgname}==",
}
}

Expand Down Expand Up @@ -184,8 +181,8 @@
group => $group,
cwd => $cwd,
environment => $environment,
path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
timeout => $timeout,
path => $path,
}
} else {
exec { "pip_install_${name}":
Expand All @@ -195,8 +192,8 @@
group => $group,
cwd => $cwd,
environment => $environment,
path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
timeout => $timeout,
path => $path,
}
}
} else {
Expand All @@ -211,8 +208,8 @@
group => $group,
cwd => $cwd,
environment => $environment,
path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
timeout => $timeout,
path => $path,
}
}

Expand All @@ -225,8 +222,8 @@
group => $group,
cwd => $cwd,
environment => $environment,
path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
timeout => $timeout,
path => $path,
}
}

Expand All @@ -239,8 +236,8 @@
group => $group,
cwd => $cwd,
environment => $environment,
path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
timeout => $timeout,
path => $path,
}
}

Expand All @@ -253,8 +250,8 @@
group => $group,
cwd => $cwd,
environment => $environment,
path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
timeout => $timeout,
path => $path,
}
}
}
Expand Down

0 comments on commit c3332b3

Please sign in to comment.