|
39 | 39 | $auth_basic = undef, |
40 | 40 | $www_root = undef, |
41 | 41 | $create_www_root = false, |
| 42 | + $alias_path = false, |
42 | 43 | $owner = '', |
43 | 44 | $groupowner = '', |
44 | 45 | $redirect = undef, |
|
99 | 100 | } |
100 | 101 |
|
101 | 102 | ## Check for various error condtiions |
| 103 | + # Check vhost |
102 | 104 | if ($vhost == undef) { |
103 | 105 | fail('Cannot create a location reference without attaching to a virtual host') |
104 | 106 | } |
105 | | - if (($www_root == undef) and ($proxy == undef) and ($redirect == undef)) { |
106 | | - fail('Cannot create a location reference without a www_root, proxy or redirect defined') |
| 107 | + # Check www_root/proxy/redirect/alias_path |
| 108 | + if (($www_root == undef) and ($proxy == undef) and ($redirect == undef) and ($alias_path == undef)) { |
| 109 | + fail('Cannot create a location reference without a www_root, proxy, redirect, or alias_path defined') |
107 | 110 | } |
108 | | - if (($www_root != undef) and ($proxy != undef)) { |
109 | | - fail('Cannot define both directory and proxy in a virtual host') |
| 111 | + $mutual_exclusive = 0 |
| 112 | + if ($www_root != undef) { |
| 113 | + $mutual_exclusive += 1; |
110 | 114 | } |
111 | | - if (($www_root != undef) and ($redirect != undef)) { |
112 | | - fail('Cannot define both directory and redirect in a virtual host') |
| 115 | + if ($redirect != undef) { |
| 116 | + $mutual_exclusive += 1; |
113 | 117 | } |
114 | | - if (($proxy != undef) and ($redirect != undef)) { |
115 | | - fail('Cannot define both proxy and redirect in a virtual host') |
| 118 | + if ($proxy != undef) { |
| 119 | + $mutual_exclusive += 1; |
| 120 | + } |
| 121 | + if ($alias_path != undef) { |
| 122 | + $mutual_exclusive += 1; |
116 | 123 | } |
| 124 | + |
| 125 | + if ($mutual_exclusive != 1) { |
| 126 | + fail("Cannot define more than one of the following values: www_root: '$www_root', redirect: '$redirect', proxy: '$proxy', and alias_path: '$alias_path'!") |
| 127 | + } |
| 128 | + |
| 129 | + # Check auth |
117 | 130 | if (($auth_basic_user_file != undef) and ($auth_basic == undef)) { |
118 | 131 | fail('Cannot define auth_basic_user_file without auth_basic') |
119 | 132 | } |
|
0 commit comments