Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Remove hardcoded packages and replace with modules #10

Merged
merged 2 commits into from

2 participants

@garethr

This commit replaced the Package resources for wget and build-essential with existing puppet modules from the forge.

This may seem a bit of a faff but it aids module reuse, here's the problem I ran into.

  • I have several puppet modules all of which require build-essential and/or wget
  • Package resourced can only to defined once by compiled catalogue
  • If you define wget and build-essential directly you're immediately incompatible with anything else that does

This may also have the knock on effect of letting the module support other operating systems. I haven't tested it but from a quick read the module doesn't appear to do anything platform specific except install build-essential.

@thomasvandoren

This looks good. I think make is needed in order to support rhel-like systems, but I'll go ahead and release this as is. Thanks!

@thomasvandoren thomasvandoren merged commit f0f01c7 into from
@thomasvandoren

Released in version 0.0.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
3  .fixtures.yml
@@ -1,3 +1,6 @@
fixtures:
+ repositories:
+ wget: git://github.com/maestrodev/puppet-wget.git
+ gcc: git://github.com/puppetlabs/puppetlabs-gcc.git
symlinks:
"redis": "#{source_dir}"
View
2  Modulefile
@@ -3,3 +3,5 @@ version '0.0.8'
author 'Thomas Van Doren'
license 'BSD'
project_page 'https://github.com/thomasvandoren/puppet-redis'
+dependency 'maestrodev/wget'
+dependency 'puppetlabs/gcc'
View
10 manifests/init.pp
@@ -92,6 +92,10 @@
$redis_slowlog_max_len = 1024,
$redis_password = false,
) {
+
+ include wget
+ include gcc
+
case $version {
/^2\.4\.\d+$/: {
if ($redis_max_clients == false) {
@@ -111,10 +115,6 @@
$redis_pkg_name = "redis-${version}.tar.gz"
$redis_pkg = "${redis_src_dir}/${redis_pkg_name}"
- package { ['build-essential', 'wget']:
- ensure => present,
- }
-
File {
owner => root,
group => root,
@@ -186,7 +186,7 @@
cwd => $redis_src_dir,
path => '/bin:/usr/bin',
unless => "test $(${redis_bin_dir}/bin/redis-server --version | cut -d ' ' -f 1) = 'Redis'",
- require => [ Exec['unpack-redis'], Package['build-essential'] ],
+ require => [ Exec['unpack-redis'], Class['gcc'] ],
}
service { 'redis':
View
8 spec/classes/redis_spec.rb
@@ -11,8 +11,8 @@
end # let
it do
- should contain_package('build-essential').with_ensure('present')
- should contain_package('wget').with_ensure('present')
+ should include_class('gcc')
+ should include_class('wget')
should contain_file('/opt/redis-src').with(:ensure => 'directory')
should contain_file('/etc/redis').with(:ensure => 'directory')
@@ -72,8 +72,8 @@
end # let
it do
- should contain_package('build-essential').with_ensure('present')
- should contain_package('wget').with_ensure('present')
+ should include_class('gcc')
+ should include_class('wget')
should contain_file('/fake/path/to/redis-src').with(:ensure => 'directory')
should contain_file('/etc/redis').with(:ensure => 'directory')
Something went wrong with that request. Please try again.