Yelp / puppet-uchiwa

Puppet module for installing Uchiwa
Apache License 2.0
20 stars 59 forks source link

Detail: undefined method `each_with_index' for nil:NilClass #53

Closed betorvs closed 8 years ago

betorvs commented 8 years ago

Hi, I'm trying use this class, but I receive this error:

Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Failed to parse template uchiwa/etc/sensu/uchiwa.json.erb:
  Filepath: /etc/puppetlabs/code/modules/uchiwa/templates/etc/sensu/uchiwa.json.erb
  Line: 4
  Detail: undefined method `each_with_index' for nil:NilClass
 at /etc/puppetlabs/code/modules/uchiwa/manifests/config.pp:8:16 on node sensu-server-1
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

My profile is:

$uchiwa_api_config = [{
  host      => 'sensu-server',
  ssl       => false,
  insecure  => false,
  port      => '4567',
  user      => 'sensu',
  pass      => 'sensu',
  path      => '/',
  timeout   => '5'
}]

class { "uchiwa":
  sensu_api_endpoints => $uchiwa_api_config,
  install_repo => false,
  host => '0.0.0.0',
  port => '3000',
  refresh => '5',
  }

Why's this error happen? It's a fresh puppetserver installation.

somic commented 8 years ago

What version of puppet are you using?

I could be wrong but looks like some sort of variable scope issue - for some reason your puppet didn't assign array from $uchiwa_api_config to \@sensu_api_endpoints on https://github.com/somic/puppet-uchiwa/blob/master/templates/etc/sensu/uchiwa.json.erb#L4

I just created a test for this situation and it passes on our puppet 3.8

betorvs commented 8 years ago

Hi, @somic thanks for your answer. My version is 4.2. I have imported other classes from puppetforge (without support for puppet 4.2) and works well. But 'yeld/uchiwa' I have this problem. Any idea? suggestion?

somic commented 8 years ago

Hm, 4.2 is new. I don't know if anyone ever tested this module on 4.2 or tried to make it work there.

Let's see if we get more opinions here but at this point my guess would be that this module doesn't work in puppet 4.2 yet.

somic commented 8 years ago

https://github.com/Yelp/puppet-uchiwa/pull/54

lauraglasu commented 8 years ago

While using the 0.3.0 version of the module, with parser set to future in a puppet 3.8.1 installation puppet complained a lot about all sorts of params not being of the right type (string, ...). Gave the values for the default params with additional quotes as required and then got the same error as the one reported here. Using the same installation and module version but without the future parser issues don't appear anymore.

solarkennedy commented 8 years ago

I've release 1.0.0, hopefully this contains all the fixes required for this issue?

queeno commented 8 years ago

Earlier this morning I tested this module from master using Puppet 4.2.2 and worked fine (except for an issue with the sensu apt repo key, which I have fixed in #62).

I expect v1.0.0 should work great with Puppet 4.2.2.

solarkennedy commented 8 years ago

ty @queeno. I did a quick release of 1.0.1 to get that Apt key fix. (looks like they changed it on 2015-08-31)

solarkennedy commented 8 years ago

@betorvs can you try updating and closing the issue if you are good to go?

betorvs commented 8 years ago

Hi @solarkennedy , I tested here and works well. Thanks.