From c4642a3ce2fd54823d820b96d8912328364546db Mon Sep 17 00:00:00 2001 From: William Yardley Date: Thu, 13 Oct 2016 12:17:11 -0700 Subject: [PATCH] add debugging information in error message (h/t to zshahan) --- manifests/resource/location.pp | 4 ++-- spec/defines/resource_location_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index 6208cfa8e..d9804f2a3 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -353,10 +353,10 @@ 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') + 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 != undef) and ($proxy != undef)) { - fail('Cannot define both directory and proxy in a virtual host') + fail("Cannot define both directory and proxy in ${vhost}:${title}") } # Use proxy, fastcgi or uwsgi template if $proxy is defined, otherwise use directory template. diff --git a/spec/defines/resource_location_spec.rb b/spec/defines/resource_location_spec.rb index 42363a854..86c054d4a 100644 --- a/spec/defines/resource_location_spec.rb +++ b/spec/defines/resource_location_spec.rb @@ -820,7 +820,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}) } + 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}) } end context 'www_root and proxy are set' do @@ -832,7 +832,7 @@ } end - it { expect { is_expected.to contain_class('nginx::resource::location') }.to raise_error(Puppet::Error, %r{Cannot define both directory and proxy in a virtual host}) } + it { expect { is_expected.to contain_class('nginx::resource::location') }.to raise_error(Puppet::Error, %r{Cannot define both directory and proxy in vhost1:rspec-test}) } end context 'when vhost name is sanitized' do