Skip to content

Commit

Permalink
Allow location_allow / location_deny, and try_files as well in locati…
Browse files Browse the repository at this point in the history
…on blocks when other attributes aren't present (issue voxpupuli#741, replaces PR voxpupuli#596, h/t to vladpanainte)

add $try_files as well
  • Loading branch information
William Yardley committed Oct 16, 2016
1 parent 7a8a412 commit 5b01ddc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,10 @@
if ($vhost == undef) {
fail('Cannot create a location reference without attaching to a virtual host')
}
if (($www_root == undef) and ($proxy == undef) and ($location_alias == undef) and ($stub_status == undef) and ($fastcgi == undef) and ($uwsgi == undef) and ($location_custom_cfg == undef) and ($internal == false) and ($try_files == undef)) {
fail("Cannot create a location reference without a www_root, proxy, location_alias, fastcgi, uwsgi, stub_status, internal, or location_custom_cfg defined in ${vhost}:${title}")
if !($www_root or $proxy or $location_alias or $stub_status or $fastcgi or $uwsgi or $location_custom_cfg or $internal or $try_files or $location_allow or $location_deny) {
fail("Cannot create a location reference without a www_root, proxy, location_alias, stub_status, fastcgi, uwsgi, location_custom_cfg, internal, try_files, location_allow, or location_deny defined in ${vhost}:${title}")
}
if (($www_root != undef) and ($proxy != undef)) {
if ($www_root and $proxy) {
fail("Cannot define both directory and proxy in ${vhost}:${title}")
}

Expand Down
2 changes: 1 addition & 1 deletion spec/defines/resource_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@
}
end

it { expect { is_expected.to contain_class('nginx::resource::location') }.to raise_error(Puppet::Error, %r{Cannot create a location reference without a www_root, proxy, location_alias, fastcgi, uwsgi, stub_status, internal, or location_custom_cfg defined in vhost1:rspec-test}) }
it { expect { is_expected.to contain_class('nginx::resource::location') }.to raise_error(Puppet::Error, %r{Cannot create a location reference without a www_root, proxy, location_alias, stub_status, fastcgi, uwsgi, location_custom_cfg, internal, try_files, location_allow, or location_deny defined in vhost1:rspec-test}) }
end

context 'www_root and proxy are set' do
Expand Down

0 comments on commit 5b01ddc

Please sign in to comment.