{"action":"created","issue":{"url":"https://api.github.com/repos/puppetlabs/pdk/issues/487","repository_url":"https://api.github.com/repos/puppetlabs/pdk","labels_url":"https://api.github.com/repos/puppetlabs/pdk/issues/487/labels{/name}","comments_url":"https://api.github.com/repos/puppetlabs/pdk/issues/487/comments","events_url":"https://api.github.com/repos/puppetlabs/pdk/issues/487/events","html_url":"https://github.com/puppetlabs/pdk/issues/487","id":317599545,"number":487,"title":"Cannot override module Hiera 5 config for unit tests","user":{"login":"ragnarkon","id":25460518,"avatar_url":"https://avatars2.githubusercontent.com/u/25460518?v=4","gravatar_id":"","url":"https://api.github.com/users/ragnarkon","html_url":"https://github.com/ragnarkon","followers_url":"https://api.github.com/users/ragnarkon/followers","following_url":"https://api.github.com/users/ragnarkon/following{/other_user}","gists_url":"https://api.github.com/users/ragnarkon/gists{/gist_id}","starred_url":"https://api.github.com/users/ragnarkon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ragnarkon/subscriptions","organizations_url":"https://api.github.com/users/ragnarkon/orgs","repos_url":"https://api.github.com/users/ragnarkon/repos","events_url":"https://api.github.com/users/ragnarkon/events{/privacy}","received_events_url":"https://api.github.com/users/ragnarkon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-25T12:07:26Z","updated_at":"2018-04-25T12:26:47Z","closed_at":null,"author_association":"NONE","body":"There appears to be no way to override the module layer Hiera 5 configuration in for unit tests. Having the ability to override the Hiera 5 module layer configuration would extremely helpful, particularly when running unit tests on eyaml data where the developer (or CI pipeline) may not have access to the public/private keys.\r\n\r\nFurthermore, if the developer *did* have access to the public/private keys, the hiera-eyaml gem is not included in the Gemfile by default, causing unit tests to fail.  (Admittedly, an easy problem for the user to fix themselves.)\r\n\r\n**Current Behavior**\r\n```\r\nfailed: rspec: ./spec/classes/init_spec.rb:9: error during compilation: Evaluation Error:\r\nError while evaluating a Function Call, Function Load Error for function\r\n'eyaml_lookup_key': Lookup using eyaml lookup_key function is only supported when\r\nthe hiera_eyaml library is present (line: 3, column: 1)\r\n```\r\n\r\n---\r\n\r\nExample `./hiera5.yaml` that should be overwritten:\r\n```yaml\r\nversion: 5\r\ndefaults:\r\n  datadir: data\r\n  lookup_key: eyaml_lookup_key\r\n  options:\r\n    pkcs7_private_key: /etc/puppetlabs/code/keys/private_key.pkcs7.pem\r\n    pkcs7_public_key: /etc/puppetlabs/code/keys/public_key.pkcs7.pem\r\nhierarchy:\r\n\r\n  - name: \"Common Eyaml\"\r\n    path: \"common.eyaml\"\r\n```\r\n\r\n`./spec/fixtures/hiera/hiera.yaml` file used for unit tests:\r\n```yaml\r\nversion: 5\r\ndefaults:\r\n  datadir: spec/fixtures/hiera/data\r\n  data_hash: yaml_data\r\nhierarchy:\r\n\r\n  - name: \"Common Eyaml\"\r\n    path: \"common.eyaml\"\r\n```\r\n\r\n`./spec/spec_helper.rb`:\r\n```ruby\r\n# ...\r\ndefault_fixtures_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))\r\n\r\nRSpec.configure do |c|\r\n  c.default_facts = default_facts\r\n  c.after(:suite) do\r\n    RSpec::Puppet::Coverage.report!\r\n  end\r\n  # Hiera config file for unit tests\r\n  c.hiera_config = File.join(default_fixtures_path, 'hiera/hiera.yaml')\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/puppetlabs/pdk/issues/comments/384268332","html_url":"https://github.com/puppetlabs/pdk/issues/487#issuecomment-384268332","issue_url":"https://api.github.com/repos/puppetlabs/pdk/issues/487","id":384268332,"user":{"login":"ragnarkon","id":25460518,"avatar_url":"https://avatars2.githubusercontent.com/u/25460518?v=4","gravatar_id":"","url":"https://api.github.com/users/ragnarkon","html_url":"https://github.com/ragnarkon","followers_url":"https://api.github.com/users/ragnarkon/followers","following_url":"https://api.github.com/users/ragnarkon/following{/other_user}","gists_url":"https://api.github.com/users/ragnarkon/gists{/gist_id}","starred_url":"https://api.github.com/users/ragnarkon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ragnarkon/subscriptions","organizations_url":"https://api.github.com/users/ragnarkon/orgs","repos_url":"https://api.github.com/users/ragnarkon/repos","events_url":"https://api.github.com/users/ragnarkon/events{/privacy}","received_events_url":"https://api.github.com/users/ragnarkon/received_events","type":"User","site_admin":false},"created_at":"2018-04-25T12:26:47Z","updated_at":"2018-04-25T12:26:47Z","author_association":"NONE","body":"A similar issue appears to have been reported here: rodjek/rspec-puppet#626"}}
{"actor":{"display_login":"ragnarkon"}}