diff options
author | Tim Smith <tsmith@chef.io> | 2018-03-16 17:21:28 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-16 17:21:28 -0700 |
commit | 9f3354f9fa70f400222448f30adaae03a4cb9baa (patch) | |
tree | 8649c37c5517e5487fb5524180f39c4767adeff3 /lib/chef/resource/sudo.rb | |
parent | 4c59225b2974e8ead22aa064e6577a741578143c (diff) | |
download | chef-9f3354f9fa70f400222448f30adaae03a4cb9baa.tar.gz |
Lazy eval empty Hash/Array resource properties.
Lamont pointed out that without a lazy eval we're freezing these and then if we try to append them later chef fails.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource/sudo.rb')
-rw-r--r-- | lib/chef/resource/sudo.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/resource/sudo.rb b/lib/chef/resource/sudo.rb index f1e517a275..01318c0ca3 100644 --- a/lib/chef/resource/sudo.rb +++ b/lib/chef/resource/sudo.rb @@ -44,12 +44,12 @@ class Chef property :users, [String, Array], description: "User(s) to provide sudo privileges to. This accepts either an array or a comma separated.", - default: [], + default: lazy { [] }, coerce: proc { |x| x.is_a?(Array) ? x : x.split(/\s*,\s*/) } property :groups, [String, Array], description: "Group(s) to provide sudo privileges to. This accepts either an array or a comma separated list. Leading % on group names is optional.", - default: [], + default: lazy { [] }, coerce: proc { |x| coerce_groups(x) } property :commands, Array, @@ -81,11 +81,11 @@ class Chef property :defaults, Array, description: "An array of defaults for the user/group.", - default: [] + default: lazy { [] } property :command_aliases, Array, description: "Command aliases that can be used as allowed commands later in the config", - default: [] + default: lazy { [] } property :setenv, [TrueClass, FalseClass], description: "Whether to permit the preserving of environment with sudo -E.", @@ -93,11 +93,11 @@ class Chef property :env_keep_add, Array, description: "An array of strings to add to env_keep.", - default: [] + default: lazy { [] } property :env_keep_subtract, Array, description: "An array of strings to remove from env_keep.", - default: [] + default: lazy { [] } property :visudo_path, String, description: "The path to visudo for config verification.", |