OLD | NEW |
1 class sitescripts ( | 1 class sitescripts ( |
2 $sitescriptsini_source = '', | 2 $sitescriptsini_source = '', |
3 $sitescriptsini_content = '', | 3 $sitescriptsini_content = '', |
4 ){ | 4 ){ |
5 | 5 |
| 6 ensure_resource('adblockplus::sitescripts::repository', 'sitescripts') |
| 7 |
6 @concat {'/etc/sitescripts.ini': | 8 @concat {'/etc/sitescripts.ini': |
7 mode => '644', | 9 mode => '644', |
8 owner => root, | 10 owner => root, |
9 group => root, | 11 group => root, |
10 } | 12 } |
11 | 13 |
12 define configfragment($content = '', $source = '') { | 14 define configfragment($content = '', $source = '') { |
13 | 15 |
14 realize(Concat['/etc/sitescripts.ini']) | 16 realize(Concat['/etc/sitescripts.ini']) |
15 | 17 |
16 concat::fragment {"/etc/sitescripts.ini#$title": | 18 concat::fragment {"/etc/sitescripts.ini#$title": |
17 target => '/etc/sitescripts.ini', | 19 target => '/etc/sitescripts.ini', |
18 content => $content, | 20 content => $content, |
19 source => "$source$content" ? { | 21 source => "$source$content" ? { |
20 '' => $title, | 22 '' => $title, |
21 default => $source, | 23 default => $source, |
22 } | 24 } |
23 } | 25 } |
24 } | 26 } |
25 | 27 |
26 ensure_packages(['python-flup']) | |
27 | |
28 if ($sitescriptsini_source != '') or ($sitescriptsini_content != '') { | 28 if ($sitescriptsini_source != '') or ($sitescriptsini_content != '') { |
29 | 29 |
30 $content = $sitescriptsini_content | 30 $content = $sitescriptsini_content |
31 $source = $sitescriptsini_source | 31 $source = $sitescriptsini_source |
32 } | 32 } |
33 else { | 33 else { |
34 | 34 |
35 $content = "# Puppet: Class['$title']\n" | 35 $content = "# Puppet: Class['$title']\n" |
36 $source = '' | 36 $source = '' |
37 } | 37 } |
38 | 38 |
39 configfragment {'/etc/sitescripts.ini': | 39 configfragment {'/etc/sitescripts.ini': |
40 content => $content, | 40 content => $content, |
41 source => $source, | 41 source => $source, |
42 } | 42 } |
43 | 43 |
44 $configfragments = hiera('sitescripts::configfragments', {}) | 44 $configfragments = hiera('sitescripts::configfragments', {}) |
45 create_resources('sitescripts::configfragment', $configfragments) | 45 create_resources('sitescripts::configfragment', $configfragments) |
46 | |
47 exec { "fetch_sitescripts": | |
48 command => "hg clone https://hg.adblockplus.org/sitescripts /opt/sitescripts
", | |
49 path => ["/usr/bin/", "/bin/"], | |
50 require => Package['mercurial'], | |
51 onlyif => "test ! -d /opt/sitescripts" | |
52 } | |
53 | |
54 cron {"update_sitescripts": | |
55 ensure => present, | |
56 command => "hg pull -q -u -R /opt/sitescripts && /opt/sitescripts/ensure_dep
endencies.py -q", | |
57 environment => hiera('cron::environment', []), | |
58 user => root, | |
59 require => Exec["fetch_sitescripts"], | |
60 minute => [15], | |
61 } | |
62 } | 46 } |
OLD | NEW |