summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2018-03-19 17:24:29 +0000
committerGitHub <noreply@github.com>2018-03-19 17:24:29 +0000
commiteefbd0168f02a3707f1403dc6311bb02d18e1e00 (patch)
treec2a50d1cab5ae0c128086b3fa54789217b958b0a
parente2eaa3fdcd9a5e2f46d90f799eedcd86cc41eb6a (diff)
parent33d7ad4d680b3f29a2a24848c074da84f1c25eb6 (diff)
downloadchef-eefbd0168f02a3707f1403dc6311bb02d18e1e00.tar.gz
Merge pull request #7002 from chef/scm_subversion
Move subversion specific properties from scm to subversion
-rw-r--r--lib/chef/resource/scm.rb21
-rw-r--r--lib/chef/resource/subversion.rb17
-rw-r--r--spec/unit/resource/scm_spec.rb11
-rw-r--r--spec/unit/resource/subversion_spec.rb12
4 files changed, 29 insertions, 32 deletions
diff --git a/lib/chef/resource/scm.rb b/lib/chef/resource/scm.rb
index 8bc55a7974..2fef1a1466 100644
--- a/lib/chef/resource/scm.rb
+++ b/lib/chef/resource/scm.rb
@@ -24,10 +24,6 @@ class Chef
default_action :sync
allowed_actions :checkout, :export, :sync, :diff, :log
- def initialize(name, run_context = nil)
- super
- end
-
property :destination, String, name_property: true, identity: true
property :repository, String
property :revision, String, default: "HEAD"
@@ -45,23 +41,6 @@ class Chef
property :checkout_branch, String, default: "deploy"
property :environment, [Hash, nil], default: nil
- def svn_arguments(arg = nil)
- @svn_arguments, arg = nil, nil if arg == false
- set_or_return(
- :svn_arguments,
- arg,
- :kind_of => String
- )
- end
-
- def svn_info_args(arg = nil)
- @svn_info_args, arg = nil, nil if arg == false
- set_or_return(
- :svn_info_args,
- arg,
- :kind_of => String)
- end
-
alias :env :environment
end
end
diff --git a/lib/chef/resource/subversion.rb b/lib/chef/resource/subversion.rb
index b093ad3097..02b9da0a42 100644
--- a/lib/chef/resource/subversion.rb
+++ b/lib/chef/resource/subversion.rb
@@ -38,6 +38,23 @@ class Chef
"#{self} (#{defined_at}) had an error: #{e.class.name}: #{svn_password ? e.message.gsub(svn_password, "[hidden_password]") : e.message}"
end
+ def svn_arguments(arg = nil)
+ @svn_arguments, arg = nil, nil if arg == false
+ set_or_return(
+ :svn_arguments,
+ arg,
+ :kind_of => String
+ )
+ end
+
+ def svn_info_args(arg = nil)
+ @svn_info_args, arg = nil, nil if arg == false
+ set_or_return(
+ :svn_info_args,
+ arg,
+ :kind_of => String)
+ end
+
property :svn_binary, String
end
end
diff --git a/spec/unit/resource/scm_spec.rb b/spec/unit/resource/scm_spec.rb
index cffc956960..33c2f17498 100644
--- a/spec/unit/resource/scm_spec.rb
+++ b/spec/unit/resource/scm_spec.rb
@@ -80,17 +80,6 @@ describe Chef::Resource::Scm do
expect(resource.svn_password).to eql("taftplz")
end
- it "has a svn_arguments String attribute" do
- resource.svn_arguments "--more-taft plz"
- expect(resource.svn_arguments).to eql("--more-taft plz")
- end
-
- it "has a svn_info_args String attribute" do
- expect(resource.svn_info_args).to be_nil
- resource.svn_info_args("--no-moar-plaintext-creds yep")
- expect(resource.svn_info_args).to eq("--no-moar-plaintext-creds yep")
- end
-
it "takes the depth as an integer for shallow clones" do
resource.depth 5
expect(resource.depth).to eq(5)
diff --git a/spec/unit/resource/subversion_spec.rb b/spec/unit/resource/subversion_spec.rb
index 2b86587f1a..dd6526e3dc 100644
--- a/spec/unit/resource/subversion_spec.rb
+++ b/spec/unit/resource/subversion_spec.rb
@@ -65,6 +65,18 @@ describe Chef::Resource::Subversion do
expect(resource.svn_arguments).to be_nil
end
+ it "has a svn_arguments String attribute" do
+ expect(resource.svn_arguments).to eq("--no-auth-cache") # the default
+ resource.svn_arguments "--more-taft plz"
+ expect(resource.svn_arguments).to eql("--more-taft plz")
+ end
+
+ it "has a svn_info_args String attribute" do
+ expect(resource.svn_info_args).to eq("--no-auth-cache") # the default
+ resource.svn_info_args("--no-moar-plaintext-creds yep")
+ expect(resource.svn_info_args).to eq("--no-moar-plaintext-creds yep")
+ end
+
it "hides password from custom exception message" do
resource.svn_password "l33th4x0rpa$$w0rd"
e = resource.customize_exception(Chef::Exceptions::Exec.new "Exception with password #{resource.svn_password}")