Created
May 29, 2014 09:13
-
-
Save vinyar/d82acb8e28488ccd50d5 to your computer and use it in GitHub Desktop.
hotfix for chef-client for when administrator is renamed (chef-client/libraries/helpers.rb)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def root_owner | |
if ['windows'].include?(node['platform']) | |
adminAccount = WMI::Win32_UserAccount.find(:first,:conditions => "SID like 'S-1-5-21-%-500' AND LocalAccount=True") | |
adminAccount.Name | |
else | |
'root' | |
end | |
end | |
def dir_owner | |
if chef_server? | |
CHEF_SERVER_USER | |
else | |
root_owner | |
end | |
end | |
def root_group | |
if %w{ openbsd freebsd mac_os_x mac_os_x_server }.include?(node['platform']) | |
'wheel' | |
elsif ['windows'].include?(node['platform']) | |
adminGroup = WMI::Win32_Group.find(:first,:conditions => "SID = 'S-1-5-32-544' AND LocalAccount=True") | |
adminGroup.Name | |
else | |
'root' | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment