Skip to content

Commit

Permalink
Merge pull request voxpupuli#923 from wyardley/issues_741_access_loca…
Browse files Browse the repository at this point in the history
…tion

Allow location_allow / location_deny as well in location blocks
  • Loading branch information
jyaworski committed Oct 17, 2016
2 parents 943df7b + 4898ed8 commit 8d5df66
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 @@ -373,10 +373,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 @@ -851,7 +851,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 8d5df66

Please sign in to comment.