Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #328 from echocat/develop
Browse files Browse the repository at this point in the history
backmerge for release 7.1.0
  • Loading branch information
dwerder authored Mar 22, 2017
2 parents 81003bc + d9ab667 commit 7f194ee
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2017-03-22 - 7.1.0 (Feature release)

#### Features:

- Add `gr_pip_install_options` param for setting install_options for pip

## 2017-03-17 - 7.0.0 (Major release)

#### Features:
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,18 @@ You can also chose to install the pip packages from a source other than PyPI, su
}
```

You can also specify an alternate source for all packages (and their dependencies) by passing options to `pip install` using `gr_pip_install_options`:
```puppet
class { '::graphite':
gr_pip_install_options => [
'--no-index',
'--find-links', 'https://example.com/pip_packages/',
],
}
```

For more details on how these options work, see the [documentation for `pip install`](https://pip.pypa.io/en/stable/reference/pip_install/).

## Usage

#### Class: `graphite`
Expand Down Expand Up @@ -945,6 +957,20 @@ Default is `undef` (string). The source of the django package that should be ins

Default is `undef` (string) The provider of the django package that should be installed.

##### `gr_pip_install_options`

Default is `undef` (array). An array of options to pass to `pip install` when installing graphite.

For example, to install packages from a repository other than PyPI, you could pass `--index-url` like this:

```puppet
class { 'graphite':
gr_pip_install_options => ['--index-url', 'https://custom-packge-server/simple/'],
}
```

For details on available options, see the [documentation for `pip install`](https://pip.pypa.io/en/stable/reference/pip_install/).

##### `gr_pip_install`

Default is true (Bool). Should packages be installed via pip
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@
# [*gr_django_provider*]
# String. The provider to use for installing django.
# Default: pip
# [*gr_pip_install_options*]
# Array. Options to pass to `pip install` when installing graphite.
# Default: undef
# [*gr_pip_install*]
# Boolean. Should the package be installed via pip
# Default: true
Expand Down Expand Up @@ -750,6 +753,7 @@
$gr_django_ver = $::graphite::params::django_ver,
$gr_django_source = $::graphite::params::django_source,
$gr_django_provider = $::graphite::params::django_provider,
$gr_pip_install_options = $::graphite::params::pip_install_options,
$gr_pip_install = true,
$gr_manage_python_packages = true,
$gr_python_binary = $::graphite::params::python_binary,
Expand Down
12 changes: 10 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
)
}

$pip_install_options = $::graphite::params::extra_pip_install_options ? {
undef => $::graphite::gr_pip_install_options,
default => union(
$::graphite::params::extra_pip_install_options,
pick($::graphite::gr_pip_install_options, [])
)
}

# # Set class variables
$gr_pkg_provider = $::graphite::gr_pip_install ? {
true => 'pip',
Expand Down Expand Up @@ -91,15 +99,15 @@
provider => $gr_pkg_provider,
require => $gr_pkg_require,
install_options => $gr_pkg_provider ? {
'pip' => $::graphite::params::pip_install_options,
'pip' => $pip_install_options,
default => undef,
},
}
)

if $::graphite::gr_django_pkg {
$django_install_options = $::graphite::gr_django_provider ? {
'pip' => $::graphite::params::pip_install_options,
'pip' => $pip_install_options,
default => undef,
}
package { $::graphite::gr_django_pkg:
Expand Down
27 changes: 14 additions & 13 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
$django_ver = '1.5'
$django_source = undef
$django_provider = 'pip'
$pip_install_options = undef
$python_binary = 'python'

$install_prefix = '/opt/'
Expand Down Expand Up @@ -92,24 +93,24 @@

case $::lsbdistcodename {
/squeeze|wheezy|precise/: {
$apache_24 = false
$graphitepkgs = union($common_os_pkgs, ['python-cairo',])
$libpath = "/usr/lib/python${pyver}/dist-packages"
$pip_install_options = undef
$apache_24 = false
$graphitepkgs = union($common_os_pkgs, ['python-cairo',])
$libpath = "/usr/lib/python${pyver}/dist-packages"
$extra_pip_install_options = undef
}

/jessie|trusty|utopic|vivid|wily/: {
$apache_24 = true
$graphitepkgs = union($common_os_pkgs, ['python-cairo',])
$libpath = "/usr/lib/python${pyver}/dist-packages"
$pip_install_options = undef
$apache_24 = true
$graphitepkgs = union($common_os_pkgs, ['python-cairo',])
$libpath = "/usr/lib/python${pyver}/dist-packages"
$extra_pip_install_options = undef
}

/xenial/: {
$apache_24 = true
$graphitepkgs = union($common_os_pkgs, ['python-cairo',])
$libpath = "/usr/local/lib/python${pyver}/dist-packages"
$pip_install_options = [{'--no-binary' => ':all:'}]
$apache_24 = true
$graphitepkgs = union($common_os_pkgs, ['python-cairo',])
$libpath = "/usr/local/lib/python${pyver}/dist-packages"
$extra_pip_install_options = [{'--no-binary' => ':all:'}]
}

default: {
Expand Down Expand Up @@ -188,7 +189,7 @@

$libpath = "/usr/lib/python${pyver}/site-packages"

$pip_install_options = undef
$extra_pip_install_options = undef
}

default: {
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dwerder-graphite",
"version": "7.0.0",
"version": "7.1.0",
"source": "https://github.com/echocat/puppet-graphite.git",
"author": "Daniel Werdermann",
"license": "Apache-2.0",
Expand Down

0 comments on commit 7f194ee

Please sign in to comment.