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

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

Issue 29370632: NoIssue - Refactor ensure_*state functions (Closed)
Patch Set: Created Jan. 3, 2017, 2:25 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/host.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) resources. 3 # Manage Puppet (https://github.com/puppetlabs/puppet) resources.
4 # 4 #
5 # === Parameters: 5 # === Parameters:
6 # 6 #
7 # [*ensure*] 7 # [*ensure*]
8 # General target policy for Puppet resources, supported values include 8 # General target policy for Puppet resources, supported values include
9 # "present", "latest", "absent" and "purged". 9 # "present", "latest", "absent" and "purged".
10 # 10 #
11 # === Examples: 11 # === Examples:
12 # 12 #
13 # class {'adblockplus::puppet': 13 # class {'adblockplus::puppet':
14 # ensure => 'latest', 14 # ensure => 'latest',
15 # } 15 # }
16 # 16 #
17 class adblockplus::puppet ( 17 class adblockplus::puppet (
18 $ensure = 'present', 18 $ensure = 'present',
19 ) { 19 ) {
20 20
21 # https://forge.puppet.com/puppetlabs/stdlib 21 # https://forge.puppet.com/puppetlabs/stdlib
22 include stdlib 22 include stdlib
23 23
24 if $ensure !~ /^(absent|purged)$/ {
25 $ensure_directory = 'directory'
26 $ensure_file = 'file'
27 }
28 else {
29 $ensure_directory = 'absent'
30 $ensure_file = 'absent'
31 }
32
33 # https://tickets.puppetlabs.com/browse/PUP-3655 24 # https://tickets.puppetlabs.com/browse/PUP-3655
34 ensure_resource('file', '/var/lib/puppet/facts.d', { 25 ensure_resource('file', '/var/lib/puppet/facts.d', {
35 ensure => $ensure_directory, 26 ensure => ensure_directory_state($ensure),
36 group => 'root', 27 group => 'root',
37 mode => 0755, 28 mode => 0755,
38 owner => 'root', 29 owner => 'root',
39 }) 30 })
40 31
41 # http://stackoverflow.com/questions/22816946/ 32 # http://stackoverflow.com/questions/22816946/
42 ensure_resource('file', '/var/lib/puppet/facts.d/pup3665', { 33 ensure_resource('file', '/var/lib/puppet/facts.d/pup3665', {
43 'content' => "#!/bin/sh\necho 'pup3665=workaround'\n\n", 34 'content' => "#!/bin/sh\necho 'pup3665=workaround'\n\n",
44 'ensure' => $ensure_file, 35 'ensure' => ensure_file_state($ensure),
45 'group' => 'root', 36 'group' => 'root',
46 'mode' => 0755, 37 'mode' => 0755,
47 'owner' => 'root', 38 'owner' => 'root',
48 }) 39 })
49 40
50 File['/var/lib/puppet/facts.d'] -> File['/var/lib/puppet/facts.d/pup3665'] 41 File['/var/lib/puppet/facts.d'] -> File['/var/lib/puppet/facts.d/pup3665']
51 } 42 }
OLDNEW
« no previous file with comments | « modules/adblockplus/manifests/host.pp ('k') | modules/adblockplus/manifests/puppet/agent.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld