OLD | NEW |
1 class sitescripts ( | 1 class sitescripts ( |
2 $sitescriptsini_source = undef | 2 $sitescriptsini_source = '', |
| 3 $sitescriptsini_content = '', |
3 ){ | 4 ){ |
4 | 5 |
5 concat {'/etc/sitescripts.ini': | 6 concat {'/etc/sitescripts.ini': |
6 mode => 644, | 7 mode => 644, |
7 owner => root, | 8 owner => root, |
8 group => root, | 9 group => root, |
9 } | 10 } |
10 | 11 |
11 define configfragment($source = $title) | 12 define configfragment($content = '', $source = '') |
12 { | 13 { |
13 concat::fragment {$source: | 14 concat::fragment {"/etc/sitescripts.ini#$title": |
14 target => '/etc/sitescripts.ini', | 15 target => '/etc/sitescripts.ini', |
15 source => $source | 16 content => $content, |
| 17 source => "$source$content" ? { |
| 18 '' => $title, |
| 19 default => $source, |
| 20 } |
16 } | 21 } |
17 } | 22 } |
18 | 23 |
19 configfragment {$sitescriptsini_source: } | 24 configfragment {'/etc/sitescripts.ini': |
| 25 content => $sitescriptsini_content, |
| 26 source => $sitescriptsini_source, |
| 27 } |
20 | 28 |
21 exec { "fetch_sitescripts": | 29 exec { "fetch_sitescripts": |
22 command => "hg clone https://hg.adblockplus.org/sitescripts /opt/sitescripts
", | 30 command => "hg clone https://hg.adblockplus.org/sitescripts /opt/sitescripts
", |
23 path => ["/usr/bin/", "/bin/"], | 31 path => ["/usr/bin/", "/bin/"], |
24 require => Package['mercurial'], | 32 require => Package['mercurial'], |
25 onlyif => "test ! -d /opt/sitescripts" | 33 onlyif => "test ! -d /opt/sitescripts" |
26 } | 34 } |
27 | 35 |
28 cron {"update_sitescripts": | 36 cron {"update_sitescripts": |
29 ensure => present, | 37 ensure => present, |
30 command => "hg pull -q -u -R /opt/sitescripts", | 38 command => "hg pull -q -u -R /opt/sitescripts", |
31 environment => ['MAILTO=admins@adblockplus.org,root'], | 39 environment => ['MAILTO=admins@adblockplus.org,root'], |
32 user => root, | 40 user => root, |
33 require => Exec["fetch_sitescripts"], | 41 require => Exec["fetch_sitescripts"], |
34 } | 42 } |
35 } | 43 } |
OLD | NEW |