Class: Vault::Provision::Auth::Ldap::Groups
- Inherits:
-
Prototype
- Object
- Prototype
- Vault::Provision::Auth::Ldap::Groups
- Defined in:
- lib/vault/provision/auth/ldap/groups.rb
Overview
placeholder
Instance Method Summary collapse
- #group_files(auth_point) ⇒ Object
- #provision! ⇒ Object
-
#repo_files ⇒ Object
Vault supports multiple instances of the ‘ldap’ backend mounted concurrently.
Instance Method Details
#group_files(auth_point) ⇒ Object
3 4 5 6 7 |
# File 'lib/vault/provision/auth/ldap/groups.rb', line 3 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 |
#provision! ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/vault/provision/auth/ldap/groups.rb', line 19 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 |
#repo_files ⇒ Object
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
13 14 15 16 17 |
# File 'lib/vault/provision/auth/ldap/groups.rb', line 13 def repo_files @vault.sys.auths.select { |_,v| v.type == 'ldap' } .keys .inject([]) { |acc, elem| acc + group_files(elem) } end |