voxpupuli / onceover

Your gateway drug to automated infrastructure testing with Puppet
141 stars 45 forks source link

hiera data not being read #319

Open simmerz opened 2 years ago

simmerz commented 2 years ago

I've got a spec/hiera.yaml file with spec.yaml as an additional entry so that onceover can get all the data that would otherwise come from a Hashicorp Vault instance. I also have a spec/hieradata directory, and my spec/hiera.yaml looks like:

---
version: 5
defaults:
  datadir: hieradata
  data_hash: yaml_data
hierarchy:
  - name: Common data
    paths:
      - common.yaml

I've got some data in spec/hieradata/common.yaml:

---
classes:
  - 'profile::base'
letsencrypt::email: hostmaster@example.com
profile::vault::server::aws_access_key: '1234557'
profile::vault::server::aws_secret_key: 'abcdef'
profile::vault::server::aws_kms_key: 'abcdef1234'
ssh::storeconfigs_enabled: false
profile::traefik::host::letsencrypt_email: hostmaster@example.com
profile::traefik::host::docker_network: frontend
profile::redis::docker::docker_network: frontend
traefik::host::auth_password: password
elasticsearch::ca_cert: foobarbaz
elasticsearch::http_cert: foobarbaz
elasticsearch::http_key: foobarbaz
elasticsearch/elastic::password: 'foobar'
elasticsearch/logstash_system::password: 'foobar'

It appears that the hieradata isn't being read at all, as I then get errors like:

profile::traefik::host: failed
  errors:
    error during compilation: Evaluation Error: Error while evaluating a Function Call, Class[Profile::Traefik::Host]:
  expects a value for parameter 'letsencrypt_email'
  expects a value for parameter 'docker_network'
  parameter 'auth_password' expects a String value, got Undef (line: 13, column: 1) on node 08713ae32bdc

I did try to move the spec common.yaml file into my main hieradata directory as hieradata/spec.yaml and just clone the root hiera.yaml, adding spec.yaml to the paths, but this doesn't seem to get read either.

Possibly related: I've always had manifest = site.pp in my environment.conf. If I keep that in, I get the following error:

profile::traefik::host: failed
  errors:
    Function lookup() did not find a value for the name 'classes'

Suggesting that the site.pp is indeed being read, and not ignore, as per the README.

My site.pp is simply:

lookup('classes', Array[String], 'unique').include