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

Commit

Permalink
Merge pull request #15 from gds-operations/use-fixed-package-versions
Browse files Browse the repository at this point in the history
Graphite module now takes $version as a parameter
  • Loading branch information
dcarley committed Dec 24, 2013
2 parents d94a9cb + 191c906 commit 7311cde
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,26 @@ Nice and simple, mainly because it's not yet very configurable.
If you want to run the web interface on a port other than 80 you can
pass this in like so:

class { 'graphite':
port => 9000,
}
```puppet
class { 'graphite':
port => 9000,
}
```

## Versioning

If you want to install a specific version of whisper and carbon, you
like so:

```puppet
class { 'graphite':
port => 9000,
version => '0.9.12',
}
```

However, it's worth saying that this won't deal with upgrades. It'll
only install the provided version on a clean run.

## Another Graphite module?

Expand Down
3 changes: 2 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
$storage_schemas_content = undef,
$storage_schemas_source = undef,
$carbon_source = undef,
$carbon_content = undef
$carbon_content = undef,
$version = $graphite::params::version,
) inherits graphite::params {
class{'graphite::deps': } ->
class{'graphite::install': } ->
Expand Down
11 changes: 6 additions & 5 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,32 @@
#
class graphite::install {
$root_dir = $::graphite::root_dir
$ver = $::graphite::version

package { 'whisper':
ensure => installed,
ensure => $ver,
provider => pip,
}

$carbon_pip_args = [
"--install-option=\"--prefix=${root_dir}\"",
"--install-option=\"--install-lib=${root_dir}/lib\"",
]
$carbon_pip_args_str = join($carbon_pip_args, ' ')
$carbon_args = join($carbon_pip_args, ' ')

exec { 'graphite/install carbon':
command => "/usr/bin/pip install ${carbon_pip_args_str} carbon",
command => "/usr/bin/pip install ${carbon_args} carbon==${ver}",
creates => "${root_dir}/bin/carbon-cache.py",
}

$graphite_pip_args = [
"--install-option=\"--prefix=${root_dir}\"",
"--install-option=\"--install-lib=${root_dir}/webapp\""
]
$graphite_pip_args_str = join($graphite_pip_args, ' ')
$graphite_web_args = join($graphite_pip_args, ' ')

exec { 'graphite/install graphite-web':
command => "/usr/bin/pip install ${graphite_pip_args_str} graphite-web",
command => "/usr/bin/pip install ${graphite_web_args} graphite-web==${ver}",
creates => "${root_dir}/webapp/graphite/manage.py",
}

Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
$admin_password = 'sha1$1b11b$edeb0a67a9622f1f2cfeabf9188a711f5ac7d236'
$port = 8000
$root_dir = '/opt/graphite'
$version = '0.9.12'
}
5 changes: 3 additions & 2 deletions spec/classes/graphite/graphite__install_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
require 'spec_helper'

describe 'graphite', :type => :class do
let(:version) { '0.9.12' }

it { should contain_exec('graphite/install carbon').
with_command("/usr/bin/pip install --install-option=\"--prefix=/opt/graphite\" --install-option=\"--install-lib=/opt/graphite/lib\" carbon") }
with_command("/usr/bin/pip install --install-option=\"--prefix=/opt/graphite\" --install-option=\"--install-lib=/opt/graphite/lib\" carbon==#{version}") }
it { should contain_exec('graphite/install graphite-web').
with_command("/usr/bin/pip install --install-option=\"--prefix=/opt/graphite\" --install-option=\"--install-lib=/opt/graphite/webapp\" graphite-web") }
with_command("/usr/bin/pip install --install-option=\"--prefix=/opt/graphite\" --install-option=\"--install-lib=/opt/graphite/webapp\" graphite-web==#{version}") }
end

0 comments on commit 7311cde

Please sign in to comment.