| OLD | NEW |
| 1 class sitescripts ( | 1 class sitescripts ( |
| 2 $sitescriptsini_source = undef | 2 $sitescriptsini_source = undef |
| 3 ){ | 3 ){ |
| 4 | 4 |
| 5 concat {'/etc/sitescripts.ini': | 5 concat {'/etc/sitescripts.ini': |
| 6 mode => 644, | 6 mode => 644, |
| 7 owner => root, | 7 owner => root, |
| 8 group => root, | 8 group => root, |
| 9 } | 9 } |
| 10 | 10 |
| 11 define configfragment($source = $title) | 11 define configfragment($source = $title) |
| 12 { | 12 { |
| 13 concat::fragment {$source: | 13 concat::fragment {$source: |
| 14 target => '/etc/sitescripts.ini', | 14 target => '/etc/sitescripts.ini', |
| 15 source => $source | 15 source => $source |
| 16 } | 16 } |
| 17 } | 17 } |
| 18 | 18 |
| 19 configfragment {$sitescriptsini_source: } | 19 configfragment {$sitescriptsini_source: } |
| 20 | 20 |
| 21 exec { "fetch_sitescripts": | 21 exec { "fetch_sitescripts": |
| 22 command => "hg clone https://hg.adblockplus.org/sitescripts /opt/sitescripts
", | 22 command => "hg clone https://hg.adblockplus.org/sitescripts /opt/sitescripts
", |
| 23 path => ["/usr/bin/", "/bin/"], | 23 path => ["/usr/bin/", "/bin/"], |
| 24 require => Package['mercurial'], | 24 require => Package['mercurial'], |
| 25 onlyif => "test ! -d /opt/sitescripts" | 25 onlyif => "test ! -d /opt/sitescripts" |
| 26 } | 26 } |
| 27 | 27 |
| 28 cron {"update_sitescripts": | 28 cron {"update_sitescripts": |
| 29 ensure => present, | 29 ensure => present, |
| 30 command => "hg pull -q -u -R /opt/sitescripts", | 30 # We spread out the pulls a little to avoid the following bug in hgweb: |
| 31 # http://bz.selenic.com/show_bug.cgi?id=3953 |
| 32 command => "bash -c 'sleep $((RANDOM \% 20))'; hg pull -q -u -R /opt/sitescr
ipts", |
| 31 environment => ['MAILTO=admins@adblockplus.org,root'], | 33 environment => ['MAILTO=admins@adblockplus.org,root'], |
| 32 user => root, | 34 user => root, |
| 33 require => Exec["fetch_sitescripts"], | 35 require => Exec["fetch_sitescripts"], |
| 34 } | 36 } |
| 35 } | 37 } |
| OLD | NEW |