Strange invalid value for Integer error

asked 2016-06-15 00:16:25 -0500

cm01 gravatar image

Hi Guys,

I got the following msg:

 Error while evaluating a Function Call, Failed to parse template nrpe/etc/nagios/nrpe.cfg.erb:
  Filepath: org/jruby/RubyString.java
  Line: 1228
  Detail: invalid value for Integer: "\n"
 at /etc/puppetlabs/code/environments/prod/modules/nrpe/manifests/classes/configuration.pp:15:15 on node

but the .erb file is only 262 lines long, so I assume for '1228', its talking about a jruby file?
The code is currently working on a 3.2 server, this is running against a v4 (2.4) server.

The only ruby style code in the .erb is

allowed_hosts=<% @env['icinga_servers'].each do |icinga_server| -%><% ipInt = Socket.gethostbyname(icinga_server)[3] %><%= "%d.%d.%d.%d," % [ipInt[0], ipInt[1], ipInt[2], ipInt[3]]   %><% end %>

but as I know nothing of Java or Ruby, I'm stuck ;)

Cheers
Chris

edit retag flag offensive close merge delete

Comments

You'll need to post more info about the assumptions this code is making about structured data in the $env Hash.

Alex Harvey gravatar imageAlex Harvey ( 2016-06-15 03:53:05 -0500 )edit

I'd narrow down the problem step by step first Just the loop works: allowed_hosts=<% @env['icinga_servers'].each do |icinga_server| -%><% end %> Assignment, too? allowed_hosts=<% @env['icinga_servers'].each do |icinga_server| -%><% ipInt = Socket.gethostbyname(icinga_server)[3] %><% end %>

Kai Burghardt gravatar imageKai Burghardt ( 2016-09-02 05:08:59 -0500 )edit