Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Commit 95dab24

Browse files
author
Martin Alfke
committed
Allow setting of a different hiera.yaml file.
If file does not exist, we assume no hiera.yaml config file is present and we use hiera defaults. fixes #105
1 parent 75be74e commit 95dab24

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

app/models/hiera_data/config.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def initialize(base_path)
1111
private
1212

1313
def load_content
14-
full_path = @base_path.join("hiera.yaml")
14+
full_path = @base_path.join(Rails.configuration.hdm["hiera_config_file"] || "hiera.yaml")
1515
defaults = Puppet::Pops::Lookup::HieraConfigV5::DEFAULT_CONFIG_HASH
1616
config = if File.exist?(full_path)
1717
parsed_file = YAML.load(File.read(full_path))

config/hdm.yml.template

+4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ development:
33
puppet_db:
44
server: "http://localhost:8083"
55
config_dir: <%= Rails.root.join('test','fixtures','files','puppet') %>
6+
hiera_config_file: "hiera_hdm.yaml" # if not set, the default value 'hiera.yaml' is used
67

78
test:
89
read_only: false
910
puppet_db:
1011
server: "http://localhost:8084"
1112
config_dir: <%= Rails.root.join('test','fixtures','files','puppet') %>
13+
#hiera_config_file: "hiera_hdm.yaml"
1214

1315
production:
1416
read_only: false
@@ -21,6 +23,7 @@ production:
2123
cert: "/path/to/certfile"
2224
ca_file: "/path/to/cafile"
2325
config_dir: "/etc/puppetlabs/code"
26+
#hiera_config_file: "hiera_hdm.yaml"
2427

2528
# Example for PE token authentication
2629
# production:
@@ -32,3 +35,4 @@ production:
3235
# token: "secret_token"
3336
# cacert: "/path/to/cacert"
3437
# config_dir: "/etc/puppetlabs/code"
38+
# hiera_config_file: "hiera_hdm.yaml"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 5
2+
defaults:
3+
datadir: data
4+
data_hash: yaml_data
5+
6+
hierarchy:
7+
- name: "Host specific"
8+
path: "nodes/%{::fqdn}.yaml"
9+
10+
- name: "Per-datacenter business group data" # Uses custom facts.
11+
paths:
12+
- "role/%{::role}.yaml"
13+
- "zone/%{::zone}.yaml"
14+
15+
- name: "Global data"
16+
paths:
17+
- "usermanagement.yaml"
18+

0 commit comments

Comments
 (0)