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

Side by Side Diff: modules/adblockplus/manifests/web/fileserver/repository.pp

Issue 29805569: #12126 - Redirect aliases to a virtual host in filerserver role (Closed)
Patch Set: Created June 12, 2018, 7:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | modules/web/templates/global.conf.erb » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # == Type: adblockplus::web::fileserver::repository 1 # == Type: adblockplus::web::fileserver::repository
2 # 2 #
3 # Manage a repository on a fileserver. 3 # Manage a repository on a fileserver.
4 # 4 #
5 # A repository is a site where a group of people can upload and artifacts. 5 # A repository is a site where a group of people can upload and artifacts.
6 # 6 #
7 # In its current form, a repository is simply a directory exposed on a web 7 # In its current form, a repository is simply a directory exposed on a web
8 # server. This may evolve to make use of more advanced repositories in the 8 # server. This may evolve to make use of more advanced repositories in the
9 # future (proxy to repository manager, or 3rd-party service, etc). 9 # future (proxy to repository manager, or 3rd-party service, etc).
10 # 10 #
11 # === parameters: 11 # === parameters:
12 # 12 #
13 # [*ensure*] 13 # [*ensure*]
14 # Whether to set up the repository or not. Removing repositories is not 14 # Whether to set up the repository or not. Removing repositories is not
15 # supported. 15 # supported.
16 # 16 #
17 # [*users*] 17 # [*users*]
18 # System users that should be created and added to the group that has 18 # System users that should be created and added to the group that has
19 # write permissions for the repository directory 19 # write permissions for the repository directory
20 # 20 #
21 # [*auth_file*] 21 # [*auth_file*]
22 # Overwrite the default options of the authentication file used for basic 22 # Overwrite the default options of the authentication file used for basic
23 # http authentication for nginx. 23 # http authentication for nginx.
24 # 24 #
25 # [*aliases*]
26 # Array of alternative names that will be redirected to the main virtual host
25 define adblockplus::web::fileserver::repository ( 27 define adblockplus::web::fileserver::repository (
26 $ensure = 'present', 28 $ensure = 'present',
27 $users = {}, 29 $users = {},
28 $auth_file = undef, 30 $auth_file = undef,
31 $aliases = [],
29 ){ 32 ){
30 33
31 $repositories_directory = "$adblockplus::directory/fileserver" 34 $repositories_directory = "$adblockplus::directory/fileserver"
32 $repository_directory = "$repositories_directory/$name" 35 $repository_directory = "$repositories_directory/$name"
33 $group_name = "www-$name" 36 $group_name = "www-$name"
34 $repository_host = $name ? { 37 $repository_host = $name ? {
35 'www' => "$adblockplus::web::fileserver::domain", 38 'www' => "$adblockplus::web::fileserver::domain",
36 default => "$name.$adblockplus::web::fileserver::domain", 39 default => "$name.$adblockplus::web::fileserver::domain",
37 } 40 }
38 $auth_filename = "${::adblockplus::directory}/htpasswd/${name}" 41 $auth_filename = "${::adblockplus::directory}/htpasswd/${name}"
39 42
40 nginx::hostconfig {"$repository_host": 43 nginx::hostconfig {"$repository_host":
44 global_config => template("web/global.conf.erb"),
41 content => template("adblockplus/web/fileserver.conf.erb"), 45 content => template("adblockplus/web/fileserver.conf.erb"),
42 is_default => false, 46 is_default => false,
43 certificate => $adblockplus::web::fileserver::certificate, 47 certificate => $adblockplus::web::fileserver::certificate,
44 private_key => $adblockplus::web::fileserver::private_key, 48 private_key => $adblockplus::web::fileserver::private_key,
45 log => 'access_log_fileserver', 49 log => 'access_log_fileserver',
46 } 50 }
47 51
48 if $auth_file != undef { 52 if $auth_file != undef {
49 ensure_resource('file', $auth_filename, merge({ 53 ensure_resource('file', $auth_filename, merge({
50 ensure => ensure_file_state($ensure), 54 ensure => ensure_file_state($ensure),
(...skipping 22 matching lines...) Expand all
73 77
74 realize(File[$adblockplus::directory]) 78 realize(File[$adblockplus::directory])
75 79
76 file {"/var/www/$repository_host": 80 file {"/var/www/$repository_host":
77 ensure => ensure_symlink_state($ensure), 81 ensure => ensure_symlink_state($ensure),
78 target => "$repository_directory", 82 target => "$repository_directory",
79 require => File["$repository_directory"], 83 require => File["$repository_directory"],
80 } 84 }
81 } 85 }
82 86
OLDNEW
« no previous file with comments | « no previous file | modules/web/templates/global.conf.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld