LEFT | RIGHT |
(no file at all) | |
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']) |
| 15 |
14 concat::fragment {"/etc/sitescripts.ini#$title": | 16 concat::fragment {"/etc/sitescripts.ini#$title": |
15 target => '/etc/sitescripts.ini', | 17 target => '/etc/sitescripts.ini', |
16 content => $content, | 18 content => $content, |
17 source => "$source$content" ? { | 19 source => "$source$content" ? { |
18 '' => $title, | 20 '' => $title, |
19 default => $source, | 21 default => $source, |
20 } | 22 } |
21 } | 23 } |
22 } | 24 } |
23 | 25 |
24 configfragment {'/etc/sitescripts.ini': | 26 if ($sitescriptsini_source != '') or ($sitescriptsini_content != '') { |
25 content => $sitescriptsini_content, | 27 |
26 source => $sitescriptsini_source, | 28 configfragment {'/etc/sitescripts.ini': |
| 29 content => $sitescriptsini_content, |
| 30 source => $sitescriptsini_source, |
| 31 } |
27 } | 32 } |
28 | 33 |
29 $configfragments = hiera('sitescripts::configfragments', {}) | 34 $configfragments = hiera('sitescripts::configfragments', {}) |
30 create_resources('sitescripts::configfragment', $configfragments) | 35 create_resources('sitescripts::configfragment', $configfragments) |
31 | 36 |
32 exec { "fetch_sitescripts": | 37 exec { "fetch_sitescripts": |
33 command => "hg clone https://hg.adblockplus.org/sitescripts /opt/sitescripts
", | 38 command => "hg clone https://hg.adblockplus.org/sitescripts /opt/sitescripts
", |
34 path => ["/usr/bin/", "/bin/"], | 39 path => ["/usr/bin/", "/bin/"], |
35 require => Package['mercurial'], | 40 require => Package['mercurial'], |
36 onlyif => "test ! -d /opt/sitescripts" | 41 onlyif => "test ! -d /opt/sitescripts" |
37 } | 42 } |
38 | 43 |
39 cron {"update_sitescripts": | 44 cron {"update_sitescripts": |
40 ensure => present, | 45 ensure => present, |
41 command => "hg pull -q -u -R /opt/sitescripts && /opt/sitescripts/ensure_dep
endencies.py -q", | 46 command => "hg pull -q -u -R /opt/sitescripts && /opt/sitescripts/ensure_dep
endencies.py -q", |
42 environment => hiera('cron::environment', []), | 47 environment => hiera('cron::environment', []), |
43 user => root, | 48 user => root, |
44 require => Exec["fetch_sitescripts"], | 49 require => Exec["fetch_sitescripts"], |
45 } | 50 } |
46 } | 51 } |
LEFT | RIGHT |