crayfishx/hiera-http

Error 500 on SERVER: Server Error: Unable to find 'lookup_key' function named 'hiera_http'

SohamChakraborty opened this issue · 2 comments

Hi,

Does anyone know what is causing this error in puppet agent -t runs:

Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Unable to find 'lookup_key' function named 'hiera_http' (file: /etc/puppetlabs/code/environments/puppetserver/hiera.yaml) on node puppet-test-xxxxx.us-east-1a.aws.internalco.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

The hiera.yaml file is this:

# cat hiera.yaml 
---
version: 5

hierarchy:
  - name: "Hiera-HTTP lookup"
    lookup_key: hiera_http
    uris:
      - http://puppet-ca-xxxxx.us-east-1a.aws.internalco.com:5984/host/%{trusted.certname}
      - http://puppet-ca-xxxxx.us-east-1a.aws.internalco.com:5984/dc/%{facts.location}
      - http://puppet-ca-xxxxx.us-east-1a.aws.internalco.com:5984/role/%{facts.role}
    options:
      output: json
      ignore_404: true 

The gems are installed:

# gem list | grep -i lookup
lookup_http (1.0.3)
# puppetserver gem list | grep -i lookup
lookup_http (1.0.3)

FYI, this is fixed now. The module was not installed in the right path and the hierarchy was not right. I still have some issues with the hierarchy but that is a different topic.

Hi Soham.

I had the same problem today. Your comment "The module was not installed in the right path..." helped me, because I tried to move it to another directory.

I issued a find command to find something with hiera_http in the name:

> find  /etc -name "hiera_http*"
/etc/puppetlabs/code/environments/production/modules/hiera_http
/etc/puppetlabs/code/environments/production/modules/hiera_http/spec/functions/hiera_http_spec.rb
/etc/puppetlabs/code/environments/production/modules/hiera_http/lib/puppet/functions/hiera_http.rb

and because there is a directory /etc/puppetlabs/code/modules I tried to move the hiera_http directory from the environments to this dir.

> mv /etc/puppetlabs/code/environments/production/modules/hiera_http /etc/puppetlabs/code/modules

Now it works as expected.

But, can please someone explain to me, what I did wrong? I issued exactly the commands from the README file. Only the comment here in the issue gave me a little hint that the module is in the wrong directory, but I really don't understand what happened.

If it's my fault, please explain it, if it's a bug in the documentation, maybe we can fix or clarify this.