Class: Vault::Provision::Sys::Policy

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

Overview

for rubocop, this comment is a matter of policy

Instance Method Summary collapse

Instance Method Details

#provision!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vault/provision/sys/policy.rb', line 7

def provision!
  repo_files.each do |rf|
    validate_file! rf
    policy_name = if rf.end_with? '.json'
                    File.basename(rf, '.json')
                  elsif rf.end_with? '.hcl'
                    File.basename(rf, '.hcl')
                  end
    next if Vault::Provision::SYSTEM_POLICIES.include? policy_name
    puts "  * #{File.basename(rf, '.json')}"
    @vault.sys.put_policy(policy_name, File.read(rf))
  end
end

#repo_filesObject



3
4
5
# File 'lib/vault/provision/sys/policy.rb', line 3

def repo_files
  Find.find(repo_path).select { |rf| rf.end_with?('.json', '.hcl') }
end