Skip to content
This repository

Remove hardcoded packages and replace with modules #10

Merged
merged 2 commits into from over 1 year ago

2 participants

Gareth Rushgrove Thomas Van Doren
Gareth Rushgrove

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.

Thomas Van Doren

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!

Thomas Van Doren thomasvandoren merged commit f0f01c7 into from
Thomas Van Doren

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.
3  .fixtures.yml
... ... @@ -1,3 +1,6 @@
1 1 fixtures:
  2 + repositories:
  3 + wget: git://github.com/maestrodev/puppet-wget.git
  4 + gcc: git://github.com/puppetlabs/puppetlabs-gcc.git
2 5 symlinks:
3 6 "redis": "#{source_dir}"
2  Modulefile
@@ -3,3 +3,5 @@ version '0.0.8'
3 3 author 'Thomas Van Doren'
4 4 license 'BSD'
5 5 project_page 'https://github.com/thomasvandoren/puppet-redis'
  6 +dependency 'maestrodev/wget'
  7 +dependency 'puppetlabs/gcc'
10 manifests/init.pp
@@ -92,6 +92,10 @@
92 92 $redis_slowlog_max_len = 1024,
93 93 $redis_password = false,
94 94 ) {
  95 +
  96 + include wget
  97 + include gcc
  98 +
95 99 case $version {
96 100 /^2\.4\.\d+$/: {
97 101 if ($redis_max_clients == false) {
@@ -111,10 +115,6 @@
111 115 $redis_pkg_name = "redis-${version}.tar.gz"
112 116 $redis_pkg = "${redis_src_dir}/${redis_pkg_name}"
113 117
114   - package { ['build-essential', 'wget']:
115   - ensure => present,
116   - }
117   -
118 118 File {
119 119 owner => root,
120 120 group => root,
@@ -186,7 +186,7 @@
186 186 cwd => $redis_src_dir,
187 187 path => '/bin:/usr/bin',
188 188 unless => "test $(${redis_bin_dir}/bin/redis-server --version | cut -d ' ' -f 1) = 'Redis'",
189   - require => [ Exec['unpack-redis'], Package['build-essential'] ],
  189 + require => [ Exec['unpack-redis'], Class['gcc'] ],
190 190 }
191 191
192 192 service { 'redis':
8 spec/classes/redis_spec.rb
@@ -11,8 +11,8 @@
11 11 end # let
12 12
13 13 it do
14   - should contain_package('build-essential').with_ensure('present')
15   - should contain_package('wget').with_ensure('present')
  14 + should include_class('gcc')
  15 + should include_class('wget')
16 16
17 17 should contain_file('/opt/redis-src').with(:ensure => 'directory')
18 18 should contain_file('/etc/redis').with(:ensure => 'directory')
@@ -72,8 +72,8 @@
72 72 end # let
73 73
74 74 it do
75   - should contain_package('build-essential').with_ensure('present')
76   - should contain_package('wget').with_ensure('present')
  75 + should include_class('gcc')
  76 + should include_class('wget')
77 77
78 78 should contain_file('/fake/path/to/redis-src').with(:ensure => 'directory')
79 79 should contain_file('/etc/redis').with(:ensure => 'directory')

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.