summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/resource/windows_user_privilege.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/chef/resource/windows_user_privilege.rb b/lib/chef/resource/windows_user_privilege.rb
index 5a9dda0a4a..142a49639b 100644
--- a/lib/chef/resource/windows_user_privilege.rb
+++ b/lib/chef/resource/windows_user_privilege.rb
@@ -136,7 +136,21 @@ class Chef
description: "Privilege to set for users.",
required: true,
coerce: proc { |v| v.is_a?(String) ? Array[v] : v },
- callbacks: { "Option privilege must include any of the: #{privilege_opts}" => proc { |n| (Array(n) - privilege_opts).empty? } }
+ callbacks: {
+ "Option privilege must include any of the: #{privilege_opts}" => lambda { |n|
+ if n.is_a?(String)
+ these_options = Array[n]
+ else
+ these_options = n
+ end
+
+ if (these_options - privilege_opts).empty?
+ true
+ else
+ false
+ end
+ },
+ }
load_current_value do |new_resource|
if new_resource.principal && (new_resource.action.include?(:add) || new_resource.action.include?(:remove))