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

Unified Diff: modules/updateserver/manifests/init.pp

Issue 5071748311547904: Issue 1094 - Generate update manifests on the update server (Closed)
Patch Set: Use flock Created July 25, 2014, 9:51 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « modules/updateserver/files/sitescripts ('k') | modules/updateserver/templates/update_update_manifests.erb » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/updateserver/manifests/init.pp
===================================================================
--- a/modules/updateserver/manifests/init.pp
+++ b/modules/updateserver/manifests/init.pp
@@ -21,17 +21,28 @@
require => Package['nginx']
}
- file {'/var/www/update':
+ $update_dir = '/var/www/update'
+
+ file {"${update_dir}":
ensure => directory,
mode => 0755
}
- file {'/var/www/update/adblockplusie':
+ $update_manifest_dirs = ["${update_dir}/adblockplus",
+ "${update_dir}/adblockplusandroid",
+ "${update_dir}/adblockplussafari"]
+
+ file {$update_manifest_dirs:
ensure => directory,
mode => 0755
}
- file {'/var/www/update/adblockplusie/update.json':
+ file {"${update_dir}/adblockplusie":
+ ensure => directory,
+ mode => 0755
+ }
+
+ file {"${update_dir}/adblockplusie/update.json":
ensure => file,
source => 'puppet:///modules/updateserver/adblockplusie/update.json',
mode => 0644
@@ -44,4 +55,67 @@
private_key => $private_key,
log => 'access_log_update'
}
+
+ class {'sitescripts':
+ sitescriptsini_source => 'puppet:///modules/updateserver/sitescripts'
+ }
+
+ $base_dir = '/var/lib/adblockplus'
+
+ file {$base_dir:
+ ensure => directory,
+ mode => 0755
+ }
+
+ $safari_certificate_path = "${base_dir}/adblockplussafari.pem"
+
+ file {$safari_certificate_path:
+ source => 'puppet:///modules/private/adblockplussafari.pem'
+ }
+
+ $repositories_to_sync = ['downloads', 'adblockplus', 'adblockplusandroid',
+ 'adblockpluschrome', 'elemhidehelper', 'abpwatcher',
+ 'abpcustomization', 'urlfixer']
+
+ define fetch_repository() {
+ $repository_path = "${updateserver::base_dir}/${title}"
+ exec {"fetch_repository_${title}":
+ command => "hg clone https://hg.adblockplus.org/${title} ${repository_path}",
+ path => '/usr/bin',
+ timeout => 0,
+ onlyif => "test ! -d ${repository_path}",
+ require => [Package['mercurial'], File[$updateserver::base_dir]]
+ }
+ }
+
+ fetch_repository {$repositories_to_sync: }
+
+ $update_update_manifests_script = '/usr/local/bin/update_update_manifests'
+
+ file {$update_update_manifests_script:
+ mode => '0755',
+ content => template('updateserver/update_update_manifests.erb')
+ }
+
+ $update_update_manifests_dependencies = ['python-m2crypto', 'python-jinja2']
+
+ package {$update_update_manifests_dependencies:}
+
+ exec {'update_update_manifests':
+ command => $update_update_manifests_script,
+ timeout => 0,
+ require => [Exec['fetch_sitescripts'],
+ Fetch_repository[$repositories_to_sync],
+ File[$update_update_manifests_script],
+ File[$update_manifest_dirs], File[$safari_certificate_path],
+ Package[$update_update_manifests_dependencies]]
+ }
+
+ cron {'update_update_manifests':
+ ensure => present,
+ environment => ['MAILTO=admins@adblockplus.org'],
+ command => $update_update_manifests_script,
+ minute => '*/10',
+ require => Exec['update_update_manifests']
+ }
}
« no previous file with comments | « modules/updateserver/files/sitescripts ('k') | modules/updateserver/templates/update_update_manifests.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld