Skip to content

Commit

Permalink
update hiera.yaml search path and datadir defaults to current standards
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tw1r3 committed Feb 7, 2024
1 parent ce505ae commit 6d80e2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Environment variables

### HIERA_YAML_PATH

The location of the `hiera.yaml` file. Defaults to `/etc/puppetlabs/code/hiera.yaml`
The location of the `hiera.yaml` file. Defaults to `/etc/puppetlabs/puppet/hiera.yaml`

### PUPPETDB_URL

Expand Down
4 changes: 2 additions & 2 deletions lib/puppet-lint/plugins/check_ghostbuster_hiera_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ def load_data(path, content)

PuppetLint.new_check(:ghostbuster_hiera_files) do
def hiera
@hiera ||= [ENV.fetch('HIERA_YAML_PATH', nil), '/etc/puppetlabs/code/hiera.yaml'].filter_map do |hiera_file|
@hiera ||= [ENV.fetch('HIERA_YAML_PATH', nil), '/etc/puppetlabs/puppetlabs/hiera.yaml'].filter_map do |hiera_file|
YAML.load_file(hiera_file) if hiera_file && File.exist?(hiera_file)
end
@hiera[0]
end

def default_datadir
hiera.dig('defaults', 'datadir') || 'hieradata'
hiera.dig('defaults', 'datadir') || 'data'
end

def path_in_datadirs?(path)
Expand Down

0 comments on commit 6d80e2c

Please sign in to comment.