Class: Vault::Provision::Sys::Mounts
- Inherits:
-
Prototype
- Object
- Prototype
- Vault::Provision::Sys::Mounts
- Defined in:
- lib/vault/provision/sys.rb
Overview
secret mounts
Constant Summary collapse
- SYSTEM_MOUNTS =
[ 'token', 'cubbyhole', 'sys', 'secret' ].freeze
Instance Method Summary collapse
Instance Method Details
#provision! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vault/provision/sys.rb', line 17 def provision! mounts = @vault.sys.mounts repo_path = "#{@instance_dir}/sys/mounts" change = [] Find.find(repo_path).each do |rf| next unless rf.end_with?('.json') next if rf.end_with?('/tune.json') rf_base = File.basename rf, '.json' next if SYSTEM_MOUNTS.include? rf_base path = rf[(repo_path.length + 1)..-6].to_sym r_conf = JSON.parse(File.read(rf)) rcc = r_conf['config'] || {} unless mounts[path] @vault.sys.mount(path.to_s, r_conf['type'], r_conf['description']) @vault.sys.mount_tune(path.to_s, rcc) change << @vault.sys.mounts[path] next end vmc = mounts[path].config || {} next if rcc.keys.inject(true) { |acc, elem| acc && (vmc[elem.to_sym] == rcc[elem]) } @vault.sys.mount_tune(path.to_s, rcc) change << @vault.sys.mounts[path] end change end |