summaryrefslogtreecommitdiff
path: root/lib/chef/client.rb
diff options
context:
space:
mode:
authorsersut <serdar@opscode.com>2013-01-14 16:21:17 -0800
committersersut <serdar@opscode.com>2013-01-22 10:53:11 -0800
commit712a17926874f023955fae3f99e5b1f588f86614 (patch)
tree8bb21360589aff2b1435535d33e2de04806cb6a3 /lib/chef/client.rb
parent7c6e10eac92d8e638953a70dd41cfac77cb366cd (diff)
downloadchef-712a17926874f023955fae3f99e5b1f588f86614.tar.gz
Introducing windows_admin_check and config option to make it fatal.
Diffstat (limited to 'lib/chef/client.rb')
-rw-r--r--lib/chef/client.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index db7af934c3..fbae0ac3ee 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -443,6 +443,10 @@ class Chef
Chef::Log.info("Starting Chef Run for #{node.name}")
run_started
+ if Chef::Platform.windows?
+ do_windows_admin_check
+ end
+
run_context = setup_run_context
converge(run_context)
@@ -518,6 +522,23 @@ class Chef
end
end
+
+ def do_windows_admin_check
+ unless Chef::Config[:solo]
+ require 'chef/win32/security'
+
+ if !Chef::ReservedNames::Win32::Security.has_admin_rights?
+ message = "chef-client doesn't have administrator privilages on node #{node_name}."
+ if Chef::Config[:fatal_windows_admin_check]
+ Chef::Log.fatal(message)
+ Chef::Log.fatal("fatal_windows_admin_check is set to TRUE.")
+ raise Chef::Exceptions::WindowsNotAdmin, message
+ else
+ Chef::Log.warn("#{message} This might cause unexpected resource failures.")
+ end
+ end
+ end
+ end
end
end