Sha256: 8748fefd139cbe316180537719546a2ec6cb6321812789cbed6b914ab27fc9ef
Contents?: true
Size: 897 Bytes
Versions: 8
Compression:
Stored size: 897 Bytes
Contents
# placeholder class Vault::Provision::Auth::Ldap::Groups < Vault::Provision::Prototype def group_files auth_point Find.find("#{@instance_dir}/auth/#{auth_point}/groups/").select do |rf| FileTest.file?(rf) && rf.end_with?('.json') end end # Vault supports multiple instances of the 'ldap' backend mounted # concurrently. The map-reducey method repo_files gets the list of # ldap mounts, calls group_files() once for each of the mounts, # then concatenates all those filenames into one big flat array def repo_files @vault.sys.auths.select { |_,v| v.type == 'ldap' } .keys .inject([]) { |acc, elem| acc + group_files(elem) } end def provision! repo_files.each do |rf| group = File.basename(rf, '.json') auth_point = rf.split('/')[-3] @vault.post "v1/auth/#{auth_point}/groups/#{group}", File.read(rf) end end end
Version data entries
8 entries across 8 versions & 1 rubygems