diff options
author | Tim Smith <tsmith@chef.io> | 2018-03-22 21:00:16 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-22 21:00:16 -0700 |
commit | acecc50fce76f03ff68827fa196cd08347ee2b25 (patch) | |
tree | ef0ce4cbf4da34efd8691a249e4a395a0f80b4ca | |
parent | 5cee9c32d3bc7a03ba25a20ad4c85c5157d4049f (diff) | |
download | chef-acecc50fce76f03ff68827fa196cd08347ee2b25.tar.gz |
Rename visudo_path -> visudo_binary and raise if the old one is used
They are entirely different concepts and users of the old one would see visudo never work. This feature went in 11/2017 and was never documented or added to the changelog, but internally we used it and there are probably a few users. We can just remove it sometime in the future, but I suspect very few will ever be impacted by this.
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/sudo.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/chef/resource/sudo.rb b/lib/chef/resource/sudo.rb index 35678ac399..03b77cb805 100644 --- a/lib/chef/resource/sudo.rb +++ b/lib/chef/resource/sudo.rb @@ -99,6 +99,9 @@ class Chef default: lazy { [] } property :visudo_path, String, + description: "Deprecated property. Do not use." + + property :visudo_binary, description: "The path to visudo for config verification.", default: "/usr/sbin/visudo" @@ -106,6 +109,12 @@ class Chef description: "The directory containing the sudoers config file.", default: lazy { platform_config_prefix } + # handle legacy cookbook property + def after_created + raise "The 'visudo_path' property from the sudo cookbook has been replaced with the 'visudo_binary' property. The path is now more intelligently determined and for most users specifying the path should no longer be necessary. If this resource still cannot determine the path to visudo then provide the full path to the binary with the 'visudo_binary' property." if visudo_path + end + + # VERY old legacy properties alias_method :user, :users alias_method :group, :groups @@ -157,7 +166,7 @@ class Chef source new_resource.template mode "0440" variables new_resource.variables - verify "#{new_resource.visudo_path} -cf %{path}" if visudo_present? + verify "#{new_resource.visudo_binary} -cf %{path}" if visudo_present? action :create end else @@ -177,7 +186,7 @@ class Chef setenv: new_resource.setenv, env_keep_add: new_resource.env_keep_add, env_keep_subtract: new_resource.env_keep_subtract - verify "#{new_resource.visudo_path} -cf %{path}" if visudo_present? + verify "#{new_resource.visudo_binary} -cf %{path}" if visudo_present? action :create end end |