ghoneycutt / puppet-module-nrpe

Puppet module to manage nrpe

Repository from Github https://github.comghoneycutt/puppet-module-nrpeRepository from Github https://github.comghoneycutt/puppet-module-nrpe

type-mismatch in 'future parser' mode

pkranenburg opened this issue · comments

When using puppet's 'future parser', a type mismatch is revealed in init.pp, line 268: comparing String to Integer.

It can be resolved as follows:

if 0+$server_port < 0 or 0+$server_port > 65535 {

Thanks! This is currently not showing up as an error. Looks like we need to write a spec test that should fail and then be fixed once we do the zero trick.

the type mismtach error happens whenever I do 'include nrpe' in a manifest that is parsed with the 'parser = future' setting in puppet.conf.

The '0+' trick works in both 'future' and 'v3 current' parser mode.

What versions are you using? This seems odd since the module is testing for the future parser and passing tests with Travis

I have nrpe 1.0.1 and puppet 3.8.1
This is the error I get with 'parser = future' set:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Comparison of: String < Integer, is not possible. Caused by 'A String is not comparable to a non String'. at /etc/puppet/environments/development/modules/nrpe/manifests/init.pp:270:19 on node tnode0.localdomain

Indeed, after adding some debug trace info like this at line 267:

$vt = type_of($server_port)
notify {"nrpe/init: type of $server_port is '$vt'":}

this is displayed:

Notice: nrpe/init: type of $server_port is 'String[4, 4]'

I have noticed that some stuff is getting a bit "hacky" around types. For another module, I have had to put port numbers in quotes in my hieradata because of whatever stdlib library comparator wants a string (basically the opposite of this issue). Are you retrieving these port values from hiera? It seems like a "port" should be of type int (i.e. no quotes) .. I wonder how it got to be a string in the first place?

I also seeing this problem when running the code on PE 2015.2.3 with puppet agent 3.8.4. Using more or less the same codebase as @pkranenburg .

Changing the travis setup in PR #41 to help identify the problem

Fixed in v1.1.0

Thanks everyone!