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

Unified Diff: modules/adblockplus/manifests/web/fileserver/repository.pp

Issue 29551585: #2317 - provide role fileserver for eyeofiles.com (Closed) Base URL: https://hg1/infrastructure
Patch Set: use single nginx conf based on $host Created Sept. 25, 2017, 11:24 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
Index: modules/adblockplus/manifests/web/fileserver/repository.pp
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/adblockplus/manifests/web/fileserver/repository.pp
@@ -0,0 +1,54 @@
+# == Type: adblockplus::web::fileserver::repository
+#
+# Manage a repository on a fileserver.
+#
+# A repository is a site where a group of people can upload and artifacts.
+#
+# In its current form, a repository is simply a directory exposed on a web
+# server. This may evolve to make use of more advanced repositories in the
+# future (proxy to repository manager, or 3rd-party service, etc).
+#
+# === parameters:
+#
+# [*ensure*]
+# Whether to set up the repository or not. Removing repositories is not
+# supported.
+#
+# TODO Members are handled manually on the target server for now.
+# Figure out how to provision them.
+#
+define adblockplus::web::fileserver::repository (
+ $ensure = 'present',
+){
+
+ $repositories_directory = "$adblockplus::directory/fileserver/repositories"
+ $repository_directory = "$repositories_directory/$name"
+ $repository_host = "$name.$adblockplus::web::fileserver::domain"
+
+ if $ensure !~ /^(absent|purged)$/ {
mathias 2017/09/25 17:06:04 Can't you avoid the conditional and base parameter
f.nicolaisen 2017/09/25 20:21:18 I can try!
+ group {"www-$name":
+ ensure => present,
+ }
+
+ file {"$repository_directory":
+ ensure => directory,
+ group => "www-$name",
+ mode => '0775',
+ require => [
+ File["$repositories_directory"],
+ Group["www-$name"],
+ ],
+ }
+
+ realize(File[$adblockplus::directory])
+
+ # TODO Figure out how to use $adblockplus::web::directory insetad of hardcoded path
mathias 2017/09/25 17:06:04 ?
f.nicolaisen 2017/09/25 20:21:18 I discussed this with Paco, and he said it would n
mathias 2017/09/25 21:08:50 The '/var/www' path is not configurable for that d
f.nicolaisen 2017/09/25 21:19:47 Acknowledged.
+ #file {"$adblockplus::web::directory/$name":
+ file {"/var/www/$repository_host":
+ ensure => link,
+ target => "$repository_directory",
+ require => File["$repository_directory"],
+ }
+ }
+}
+

Powered by Google App Engine
This is Rietveld