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

Unified Diff: modules/adblockplus/manifests/sitescripts/repository.pp

Issue 29632558: #5944 - Introduce Puppet namespace adblockplus::sitescripts (Closed)
Patch Set: Created Dec. 7, 2017, 12:06 p.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/adblockplus/manifests/sitescripts.pp ('k') | modules/sitescripts/manifests/init.pp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/adblockplus/manifests/sitescripts/repository.pp
diff --git a/modules/adblockplus/manifests/sitescripts/repository.pp b/modules/adblockplus/manifests/sitescripts/repository.pp
new file mode 100644
index 0000000000000000000000000000000000000000..07e2c34183b905df8c32151c1f8b0ae76891edb0
--- /dev/null
+++ b/modules/adblockplus/manifests/sitescripts/repository.pp
@@ -0,0 +1,44 @@
+define adblockplus::sitescripts::repository (
+ $location = "/opt/$name",
+ $source = "https://hg.adblockplus.org/$name",
+) {
+
+ ensure_packages([
+ 'python',
+ 'python-flup',
+ ])
+
+ $ensure_dependencies_command = shellquote([
+ 'python', '--', "$location/ensure_dependencies.py", '-q'
+ ])
+
+ $fetch_command = join([
+ shellquote(['hg', 'clone', $source, $location]),
+ $ensure_dependencies_command,
+ ], ' && ')
+
+ exec { "fetch_$name":
+ command => shellquote(['hg', 'clone', $source, $location]),
+ creates => $location,
+ path => ['/usr/bin/', '/bin/'],
+ require => Package['mercurial'],
+ }
+
+ Exec["fetch_$name"] <- Package['mercurial']
+ Exec["fetch_$name"] <- Package['python']
+
+ $update_command = join([
+ shellquote(['hg', 'pull', '-q', '-u', '-R', $location]),
+ $ensure_dependencies_command,
+ ], ' && ')
+
+ cron {"update_$name":
+ ensure => 'present',
+ command => $update_command,
+ environment => hiera('cron::environment', []),
+ user => 'root',
+ minute => [15],
+ }
+
+ Cron["update_$name"] <- Exec["fetch_$name"]
+}
« no previous file with comments | « modules/adblockplus/manifests/sitescripts.pp ('k') | modules/sitescripts/manifests/init.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld