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

Side by Side Diff: modules/sitescripts/manifests/init.pp

Issue 29339227: Issue 3881 - Ensure sitescripts.ini being present even if empty (Closed)
Patch Set: Created March 31, 2016, 4:14 p.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 | « no previous file | modules/web/manifests/server.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 sitescripts ( 1 class sitescripts (
2 $sitescriptsini_source = '', 2 $sitescriptsini_source = '',
3 $sitescriptsini_content = '', 3 $sitescriptsini_content = '',
4 ){ 4 ){
5 5
6 @concat {'/etc/sitescripts.ini': 6 @concat {'/etc/sitescripts.ini':
7 mode => 644, 7 mode => 644,
8 owner => root, 8 owner => root,
9 group => root, 9 group => root,
10 } 10 }
11 11
12 define configfragment($content = '', $source = '') { 12 define configfragment($content = '', $source = '') {
13 13
14 realize(Concat['/etc/sitescripts.ini']) 14 realize(Concat['/etc/sitescripts.ini'])
15 15
16 concat::fragment {"/etc/sitescripts.ini#$title": 16 concat::fragment {"/etc/sitescripts.ini#$title":
17 target => '/etc/sitescripts.ini', 17 target => '/etc/sitescripts.ini',
18 content => $content, 18 content => $content,
19 source => "$source$content" ? { 19 source => "$source$content" ? {
20 '' => $title, 20 '' => $title,
21 default => $source, 21 default => $source,
22 } 22 }
23 } 23 }
24 } 24 }
25 25
26 if ($sitescriptsini_source != '') or ($sitescriptsini_content != '') { 26 if ($sitescriptsini_source != '') or ($sitescriptsini_content != '') {
27 27
28 configfragment {'/etc/sitescripts.ini': 28 $content = $sitescriptsini_content
29 content => $sitescriptsini_content, 29 $source = $sitescriptsini_source
30 source => $sitescriptsini_source, 30 }
31 } 31 else {
32
33 $content = "# Puppet: Class['$title']\n"
34 $source = ''
35 }
36
37 configfragment {'/etc/sitescripts.ini':
38 content => $content,
39 source => $source,
32 } 40 }
33 41
34 $configfragments = hiera('sitescripts::configfragments', {}) 42 $configfragments = hiera('sitescripts::configfragments', {})
35 create_resources('sitescripts::configfragment', $configfragments) 43 create_resources('sitescripts::configfragment', $configfragments)
36 44
37 exec { "fetch_sitescripts": 45 exec { "fetch_sitescripts":
38 command => "hg clone https://hg.adblockplus.org/sitescripts /opt/sitescripts ", 46 command => "hg clone https://hg.adblockplus.org/sitescripts /opt/sitescripts ",
39 path => ["/usr/bin/", "/bin/"], 47 path => ["/usr/bin/", "/bin/"],
40 require => Package['mercurial'], 48 require => Package['mercurial'],
41 onlyif => "test ! -d /opt/sitescripts" 49 onlyif => "test ! -d /opt/sitescripts"
42 } 50 }
43 51
44 cron {"update_sitescripts": 52 cron {"update_sitescripts":
45 ensure => present, 53 ensure => present,
46 command => "hg pull -q -u -R /opt/sitescripts && /opt/sitescripts/ensure_dep endencies.py -q", 54 command => "hg pull -q -u -R /opt/sitescripts && /opt/sitescripts/ensure_dep endencies.py -q",
47 environment => hiera('cron::environment', []), 55 environment => hiera('cron::environment', []),
48 user => root, 56 user => root,
49 require => Exec["fetch_sitescripts"], 57 require => Exec["fetch_sitescripts"],
50 } 58 }
51 } 59 }
OLDNEW
« no previous file with comments | « no previous file | modules/web/manifests/server.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld