Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiera failure on incorrect file extension. #174

Open
lordnynex opened this issue Oct 19, 2016 · 1 comment
Open

Hiera failure on incorrect file extension. #174

lordnynex opened this issue Oct 19, 2016 · 1 comment

Comments

@lordnynex
Copy link

Hello,

Just spent a fair bit of time chasing an obscure exception (filing in a separate issue). It appears the code is looking for a default 'common.yaml' (emphasis on yAml). It's pretty common to abbreviate .yaml to .yml. May be a good feature to detect the alternate condensed .yml extension.

@tomeon
Copy link
Contributor

tomeon commented Oct 19, 2016

@lordnynex -- unfortunately this is a shortcoming of Hiera itself.

Here's Hiera::Backend.datasourcefiles

def datasourcefiles(backend, scope, extension, override=nil, hierarchy=nil)
  datadir = Backend.datadir(backend, scope)
  Backend.datasources(scope, override, hierarchy) do |source|
    Hiera.debug("Looking for data source #{source}")
    file = datafile_in(datadir, source, extension)

    if file
      yield source, file
    end
  end
end

And here's Hiera::Backend::Yaml_backend

Backend.datasourcefiles(:yaml, scope, "yaml", order_override) do |source, yamlfile|

Because the YAML backend hardcodes "yaml" as the argument bound to extension, the only way for us to override it is to subclass Hiera::Backend::Yaml_backend and invoke datasourcefiles with "yml" as well. This is probably overkill, but maybe we should at least warn users about the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants