Skip to content

Instantly share code, notes, and snippets.

@vinyar
Created May 29, 2014 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinyar/d82acb8e28488ccd50d5 to your computer and use it in GitHub Desktop.
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)
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