From a6aa99e9510ddf4d87d4f081c2d8852647c1f6c0 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 27 Apr 2018 15:41:02 -0700 Subject: Convert properties in subversion to use property Retained the False = nil behavior which is actually tested in the specs already. Signed-off-by: Tim Smith --- lib/chef/resource/subversion.rb | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/lib/chef/resource/subversion.rb b/lib/chef/resource/subversion.rb index 02b9da0a42..d67fd22834 100644 --- a/lib/chef/resource/subversion.rb +++ b/lib/chef/resource/subversion.rb @@ -22,40 +22,27 @@ require "chef/resource/scm" class Chef class Resource class Subversion < Chef::Resource::Scm - description "Use the subversion resource to manage source control resources that"\ - " exist in a Subversion repository." + description "Use the subversion resource to manage source control resources that exist in a Subversion repository." allowed_actions :force_export - def initialize(name, run_context = nil) - super - @svn_arguments = "--no-auth-cache" - @svn_info_args = "--no-auth-cache" - end + property :svn_arguments, [String, nil, FalseClass], + description: "The extra arguments that are passed to the Subversion command.", + coerce: proc { |v| v == false ? nil : v }, # coerce false to nil + default: "--no-auth-cache" + + property :svn_info_args, [String, nil, FalseClass], + description: "Use when the svn info command is used by the chef-client and arguments need to be passed. The svn_arguments command does not work when the svn info command is used.", + coerce: proc { |v| v == false ? nil : v }, # coerce false to nil + default: "--no-auth-cache" + + property :svn_binary, String, + description: "The location of the svn binary." # Override exception to strip password if any, so it won't appear in logs and different Chef notifications def custom_exception_message(e) "#{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 end -- cgit v1.2.1