1

I'm trying to use icinga2's puppet module which defines a custom function and a template where it is used. I'm using the following (stripped) hiera configuration:

icinga2::object::host:
  host.com:
    target_file_name: host.conf
    display_name: host.com
    ipv4_address: XXX
    vars:
      os: Linux

The template without vars renders completely fine but when it is included, puppet fails to evaluate the function call in the template:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Failed to parse template icinga2/object_host.conf.erb:
  Filepath: org/jruby/RubyKernel.java
  Line: 1072
  Detail: Could not autoload puppet/parser/functions/icinga2_config_value: no such file to load -- puppet/icinga2/utils
 at /etc/puppetlabs/code/environments/production/modules/icinga2/manifests/object/host.pp:71:18 on node XXX

Also puppet finds and executes the command just fine when called directly in an inline template:

root@puppetmaster:~# /opt/puppetlabs/bin/puppet apply -e "notice(inline_template(\"<%= scope.function_icinga2_config_value([[1,2]]) %>\"))"
Notice: Scope(Class[main]): [
    "1",
    "2",
  ]

I've also found some bugs (1, 2) that go into a similar direction but they where fixed years ago and the suggested workaround also do not work. I'm using the very recent version of 4.2.1.

Any idea how to further debug this issue or to fix it in the icinga2 module?

  • The root error seems to be a failure to load `puppet/icinga2/utils.rb`. Can you locate that file on your master? – Felix Frank Aug 12 '15 at 20:30
  • Yeah, thanks for pointing me in the right direction! The require statement was failing because somehow puppet was not able to find the file (but just in the agent run). It seems that other people had similar problems but as a ruby & puppet noob I'm not able to judge if they are really correct or the best way to do it. Nevertheless, I've created a [PR](https://github.com/Icinga/puppet-icinga2/pull/132) with my fix. – Martin Prebio Aug 12 '15 at 23:23

0 Answers0