Class: Vault::Provision::Sys::Auth

Inherits:
Prototype
  • Object
show all
Defined in:
lib/vault/provision/sys/auth.rb

Overview

helps to enable authentication

Instance Method Summary collapse

Instance Method Details

#provision!Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vault/provision/sys/auth.rb', line 3

def provision!
  auths = @vault.sys.auths

  change = []
  repo_files.each do |rf|
    validate_file! rf
    path = rf[(repo_path.length + 1)..-6].to_sym
    r_conf = JSON.parse(File.read(rf))

    puts "  * #{File.basename(rf, '.json')} (#{r_conf['type']})"
    next if auths[path]
    @vault.sys.enable_auth(path.to_s,
                           r_conf['type'], r_conf['description'])
    change << @vault.sys.auths[path]
  end

  change
end