Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/adblockplus/manifests/puppet.pp

Issue 29367556: Issue 3065 - Refactor adblockplus::puppet module to include Puppet patches (Closed)
Patch Set: (remove accidental changes) Created Dec. 15, 2016, 10 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « modules/adblockplus/manifests/init.pp ('k') | modules/adblockplus/manifests/puppet/agent.pp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # == Class: adblockplus::puppet 1 # == Class: adblockplus::puppet
2 # 2 #
3 # Manage Puppet (https://github.com/puppetlabs/puppet) agent configuration. 3 # Manage Puppet (https://github.com/puppetlabs/puppet) resources.
4 # 4 #
5 # === Parameters: 5 # === Parameters:
6 # 6 #
7 # [*package*] 7 # [*ensure*]
8 # Custom parameters for the implicit Package['puppet'] resource. 8 # General target policy for Puppet resources, supported values include
9 # 9 # "present", "latest", "absent" and "purged".
10 # [*service*]
11 # Custom parameters for the Service['puppet'] resource implicitly defined
12 # if Package['puppet'] is ensured to be neither "absent" nor "purged".
13 # 10 #
14 # === Examples: 11 # === Examples:
15 # 12 #
16 # class {'adblockplus::puppet': 13 # class {'adblockplus::puppet':
17 # package => { 14 # ensure => 'latest',
18 # 'ensure' => 'present',
19 # 'name' => 'puppet',
20 # },
21 # service => {
22 # 'ensure' => 'stopped',
23 # 'name' => 'puppet',
24 # },
25 # } 15 # }
26 # 16 #
27 class adblockplus::puppet ( 17 class adblockplus::puppet (
28 $package = hiera('adblockplus::puppet::package', {}), 18 $ensure = 'present',
29 $service = hiera('adblockplus::puppet::service', {}),
30 ) { 19 ) {
31 20
32 # https://forge.puppet.com/puppetlabs/stdlib 21 # https://forge.puppet.com/puppetlabs/stdlib
33 include stdlib 22 include stdlib
34 23
35 # https://forge.puppet.com/puppetlabs/stdlib#ensure_resource 24 if $ensure !~ /^(absent|purged)$/ {
36 ensure_resource('package', 'puppet', $package) 25 $ensure_directory = 'directory'
26 $ensure_file = 'file'
27 }
28 else {
29 $ensure_directory = 'absent'
30 $ensure_file = 'absent'
31 }
37 32
38 # https://forge.puppet.com/puppetlabs/stdlib#getparam 33 # https://tickets.puppetlabs.com/browse/PUP-3655
39 if getparam(Package['puppet'], 'ensure') !~ /^(absent|purged)$/ { 34 ensure_resource('file', '/var/lib/puppet/facts.d', {
35 ensure => $ensure_directory,
36 group => 'root',
37 mode => 0755,
38 owner => 'root',
39 })
40 40
41 ensure_resource('service', 'puppet', merge({ 41 # http://stackoverflow.com/questions/22816946/
42 'ensure' => 'stopped', 42 ensure_resource('file', '/var/lib/puppet/facts.d/pup3665', {
43 'hasrestart' => true, 43 'content' => "#!/bin/sh\necho 'pup3665=workaround'\n",
44 'hasstatus' => true, 44 'ensure' => $ensure_file,
45 }, $service)) 45 'group' => 'root',
46 'mode' => 0755,
47 'owner' => 'root',
48 })
46 49
47 Service['puppet'] <- Package['puppet'] 50 File['/var/lib/puppet/facts.d'] -> File['/var/lib/puppet/facts.d/pup3665']
48 }
49 } 51 }
OLDNEW
« no previous file with comments | « modules/adblockplus/manifests/init.pp ('k') | modules/adblockplus/manifests/puppet/agent.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld