Vendor the external cookbooks

Knife-Zero doesn't include Berkshelf support, so vendoring everything in
the repo is convenient again
This commit is contained in:
Greg Karékinian
2019-10-13 19:17:42 +02:00
parent f4bfe31ac1
commit a32f34b408
1245 changed files with 100630 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
module Users
# Helpers for Users
module OsxHelper
def dscl(*args)
host = '.'
stdout_result = ''
stderr_result = ''
cmd = "dscl #{host} -#{args.join(' ')}"
status = shell_out(cmd)
status.stdout.each_line { |line| stdout_result << line }
status.stderr.each_line { |line| stderr_result << line }
[cmd, status, stdout_result, stderr_result]
end
def safe_dscl(*args)
result = dscl(*args)
return '' if (args.first =~ /^delete/) && (result[1].exitstatus != 0)
raise(Chef::Exceptions::Group, "dscl error: #{result.inspect}") unless result[1].exitstatus == 0
raise(Chef::Exceptions::Group, "dscl error: #{result.inspect}") if result[2] =~ /No such key: /
result[2]
end
def gid_used?(gid)
return false unless gid
groups_gids = safe_dscl('list /Groups gid')
!!(groups_gids =~ Regexp.new("#{Regexp.escape(gid.to_s)}\n"))
end
end
end