example42 / puppet-monit

Puppet module for Monit
Other
3 stars 12 forks source link

Error: Evaluation Error: Error while evaluating a Function Call, any2bool(): Unknown type of boolean given #18

Open bobweston opened 8 years ago

bobweston commented 8 years ago

Expected Behavior

To be able to provision monit

Actual Behavior

When trying to provision Monit, I'm getting the following error:

Error: Evaluation Error: Error while evaluating a Function Call, any2bool(): Unknown type of boolean given at (snip) monit/manifests/init.pp:357:18

Steps to Reproduce the Problem

  1. provision monit with puppet using mod 'example42-monit', '2.0.17', mod 'example42-puppi', '2.1.12'

    Specifications

Please add this info:

  1. Output of facter -p on the failing node (at least the OS related facts)
  2. Version of Puppet and of the module: puppet 4.5.2 and version 2.0.17 of module
  3. The relevant Puppet code and eventually Hiera data

I get this error just trying to do a basic configuration in puppet. (nothing fancy.)

class { 'monit': }

bobweston commented 8 years ago

Ok. this looks like it is a namespace clash between the puppet firewall module and this module (when configuring via hiera).

The monit module sees the firewall hash as defining the value of $firewall. (hence the error: unknown type of boolean. (It's not a boolean, it's a hash)).

We're configuring monit via hiera like this:

monit::template: "profile/monit/monitrc.erb"
monit::source_dir: false
monit_interact::options:
  daemon_interval: 120
  logfile: /var/log/monit.log
  idfile: /var/lib/monit/id
  statefile: /var/lib/monit/state
  mailserver: xxxxx
  mmonit_server: xxxxxxxx
  mmonit_port: xxxxxx
  mmonit_user: xxxxx
  mmonit_pass: xxxxxx

The hiera bits configuring the firewall look like this:

firewall:
  '501 open HTTP port':
    dport:
      - 80
    proto: tcp
    action: accept
  '501 open SSL port':
    dport:
      - 443
    proto: tcp
    action: accept

I've cloned the 2.18 tag and tested renaming $firewall to $fw in monit and that fixes the issue. I'll submit a pull request later today. The change passes the tests for changes I've made. But there are other tests unrelated that are (and were before this patch) failing. I have not fixed those.