diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index 90b05edd6..64bc80445 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -84,8 +84,8 @@ # } define nginx::resource::location ( - $location, $ensure = present, + $location = $name, $vhost = undef, $www_root = undef, $index_files = [ @@ -128,6 +128,8 @@ default => file, } + $location_sanitized = regsubst($location, '\/', '_', 'G') + ## Check for various error conditions if ($vhost == undef) { fail('Cannot create a location reference without attaching to a virtual host') @@ -164,7 +166,7 @@ ## Create stubs for vHost File Fragment Pattern if ($ssl_only != true) { - file {"${nginx::config::nx_temp_dir}/nginx.d/${vhost}-${priority}-${name}": + file {"${nginx::config::nx_temp_dir}/nginx.d/${vhost}-${priority}-${location_sanitized}": ensure => $ensure_real, content => $content_real, } @@ -173,7 +175,7 @@ ## Only create SSL Specific locations if $ssl is true. if ($ssl == true) { $ssl_priority = $priority + 300 - file {"${nginx::config::nx_temp_dir}/nginx.d/${vhost}-${ssl_priority}-${name}-ssl": + file {"${nginx::config::nx_temp_dir}/nginx.d/${vhost}-${ssl_priority}-${location_sanitized}-ssl": ensure => $ensure_real, content => $content_real, } @@ -181,7 +183,7 @@ if ($auth_basic_user_file != undef) { #Generate htpasswd with provided file-locations - file { "${nginx::params::nx_conf_dir}/${name}_htpasswd": + file { "${nginx::params::nx_conf_dir}/${location_sanitized}_htpasswd": ensure => $ensure, mode => '0644', source => $auth_basic_user_file,