oof. well, at least "apply" is easier to search&replace on than "puppet"
+1

On Sat, Aug 21, 2010 at 8:12 PM, Markus Roberts <[email protected]> wrote:

> Basing pervasive low-level behaviour changes on the application name isn't
> a
> good idea, but if we're going to do it we need to remember to update the
> test
> when we rename the application.
>
> I am not certain that this change is globally correct; there may be other
> related problems that will not be fixed (and may in fact be exacerbated) by
> this patch.
>
> Signed-off-by: Markus Roberts <[email protected]>
> ---
>  lib/puppet/file_serving/indirection_hooks.rb |    4 ++--
>  spec/shared_behaviours/file_serving.rb       |   13 ++++++++++++-
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/lib/puppet/file_serving/indirection_hooks.rb
> b/lib/puppet/file_serving/indirection_hooks.rb
> index 7e0c179..a85e90e 100644
> --- a/lib/puppet/file_serving/indirection_hooks.rb
> +++ b/lib/puppet/file_serving/indirection_hooks.rb
> @@ -19,8 +19,8 @@ module Puppet::FileServing::IndirectionHooks
>     return PROTOCOL_MAP["file"] if request.key =~ /^#{::File::SEPARATOR}/
>     return PROTOCOL_MAP["file"] if request.protocol == "file"
>
> -    # We're heading over the wire the protocol is 'puppet' and we've got a
> server name or we're not named 'puppet'
> -    if request.protocol == "puppet" and (request.server or
> Puppet.settings[:name] != "puppet")
> +    # We're heading over the wire the protocol is 'puppet' and we've got a
> server name or we're not named 'apply' or 'puppet'
> +    if request.protocol == "puppet" and (request.server or
> !["puppet","apply"].include?(Puppet.settings[:name]))
>       return PROTOCOL_MAP["puppet"]
>     end
>
> diff --git a/spec/shared_behaviours/file_serving.rb
> b/spec/shared_behaviours/file_serving.rb
> index c86453a..5f5b2b0 100644
> --- a/spec/shared_behaviours/file_serving.rb
> +++ b/spec/shared_behaviours/file_serving.rb
> @@ -15,7 +15,7 @@ describe "Puppet::FileServing::Files", :shared => true do
>     @test_class.find(uri)
>   end
>
> -  it "should use the rest terminus when the 'puppet' URI scheme is used,
> no host name is present, and the process name is not 'puppet'" do
> +  it "should use the rest terminus when the 'puppet' URI scheme is used,
> no host name is present, and the process name is not 'puppet' or 'apply'" do
>     uri = "puppet:///fakemod/my/file"
>     Puppet.settings.stubs(:value).returns "foo"
>     Puppet.settings.stubs(:value).with(:name).returns("puppetd")
> @@ -35,6 +35,17 @@ describe "Puppet::FileServing::Files", :shared => true
> do
>     @test_class.find(uri)
>   end
>
> +  it "should use the file_server terminus when the 'puppet' URI scheme is
> used, no host name is present, and the process name is 'apply'" do
> +    uri = "puppet:///fakemod/my/file"
> +    Puppet::Node::Environment.stubs(:new).returns(stub("env", :name =>
> "testing", :module => nil, :modulepath => []))
> +    Puppet.settings.stubs(:value).returns ""
> +    Puppet.settings.stubs(:value).with(:name).returns("apply")
> +
>  Puppet.settings.stubs(:value).with(:fileserverconfig).returns("/whatever")
> +    @indirection.terminus(:file_server).expects(:find)
> +    @indirection.terminus(:file_server).stubs(:authorized?).returns(true)
> +    @test_class.find(uri)
> +  end
> +
>   it "should use the file terminus when the 'file' URI scheme is used" do
>     uri = "file:///fakemod/my/file"
>     @indirection.terminus(:file).expects(:find)
> --
> 1.7.0.4
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<puppet-dev%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to