diff options
author | Daniel DeLeo <dan@opscode.com> | 2010-06-04 08:47:50 -0700 |
---|---|---|
committer | Daniel DeLeo <dan@opscode.com> | 2010-06-04 08:47:50 -0700 |
commit | 60056577a6be33a5ffb49f5bef9f94fb70f3a6e9 (patch) | |
tree | 035c72af4c5455bd68b5b53d46bbee5d8bdb7e8d | |
parent | d572c84b58ac54004b291519bd649d2a623db49d (diff) | |
download | chef-60056577a6be33a5ffb49f5bef9f94fb70f3a6e9.tar.gz |
[CHEF-1189] set defaults for svn_args and info_args to no auth cache
* subversion resource defaults to --no-auth-cache
* fixed a bug where svn_info_args was just an alias for svn_arguments
* can reset svn_args and svn_info_args to nil by giving them false
(primarily for testing)
-rw-r--r-- | chef/lib/chef/resource/scm.rb | 4 | ||||
-rw-r--r-- | chef/lib/chef/resource/subversion.rb | 2 | ||||
-rw-r--r-- | chef/spec/unit/provider/subversion_spec.rb | 2 | ||||
-rw-r--r-- | chef/spec/unit/resource/subversion_spec.rb | 20 |
4 files changed, 26 insertions, 2 deletions
diff --git a/chef/lib/chef/resource/scm.rb b/chef/lib/chef/resource/scm.rb index 081813147d..29191de32a 100644 --- a/chef/lib/chef/resource/scm.rb +++ b/chef/lib/chef/resource/scm.rb @@ -92,6 +92,7 @@ class Chef end def svn_arguments(arg=nil) + @svn_arguments, arg = nil, nil if arg == false set_or_return( :svn_arguments, arg, @@ -100,8 +101,9 @@ class Chef end def svn_info_args(arg=nil) + @svn_info_args, arg = nil, nil if arg == false set_or_return( - :svn_arguments, + :svn_info_args, arg, :kind_of => String) end diff --git a/chef/lib/chef/resource/subversion.rb b/chef/lib/chef/resource/subversion.rb index 488a47e8bd..97f48c3a44 100644 --- a/chef/lib/chef/resource/subversion.rb +++ b/chef/lib/chef/resource/subversion.rb @@ -24,6 +24,8 @@ class Chef def initialize(name, run_context=nil) super + @svn_arguments = '--no-auth-cache' + @svn_info_args = '--no-auth-cache' @resource_name = :subversion @provider = Chef::Provider::Subversion allowed_actions << :force_export diff --git a/chef/spec/unit/provider/subversion_spec.rb b/chef/spec/unit/provider/subversion_spec.rb index e7ae1f409a..f38db85f1b 100644 --- a/chef/spec/unit/provider/subversion_spec.rb +++ b/chef/spec/unit/provider/subversion_spec.rb @@ -26,6 +26,8 @@ describe Chef::Provider::Subversion do @resource.repository "http://svn.example.org/trunk/" @resource.destination "/my/deploy/dir" @resource.revision "12345" + @resource.svn_arguments(false) + @resource.svn_info_args(false) @node = Chef::Node.new @run_context = Chef::RunContext.new(@node, {}) @provider = Chef::Provider::Subversion.new(@resource, @run_context) diff --git a/chef/spec/unit/resource/subversion_spec.rb b/chef/spec/unit/resource/subversion_spec.rb index c0cd6a989e..5b71747d2d 100644 --- a/chef/spec/unit/resource/subversion_spec.rb +++ b/chef/spec/unit/resource/subversion_spec.rb @@ -36,5 +36,23 @@ describe Chef::Resource::Subversion do it "allows the force_export action" do @svn.allowed_actions.should include(:force_export) end - + + it "sets svn info arguments to --no-auth-cache by default" do + @svn.svn_info_args.should == '--no-auth-cache' + end + + it "resets svn info arguments to nil when given false in the setter" do + @svn.svn_info_args(false) + @svn.svn_info_args.should be_nil + end + + it "sets svn arguments to --no-auth-cache by default" do + @svn.svn_arguments.should == '--no-auth-cache' + end + + it "resets svn arguments to nil when given false in the setter" do + @svn.svn_arguments(false) + @svn.svn_arguments.should be_nil + end + end
\ No newline at end of file |