Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Puppet duplicate declaration: Class[Mongodb] is already declared; cannot redeclare

Tags:

vagrant

puppet

Possibly doing something extremely stupid here but I can't find any documentation on what could be causing this.

Setting up a Vagrant VM using Puppet and I'm trying to override a specific setting within the mongodb module.

As far as I'm aware the README.md syntax is incorrect in that repo (Although I have tried that too).

My Manifest:

include mongodb

class { 'mongodb' :
port => '1111';
}

When running vagrant up I get the following Error:

Duplicate declaration: Class[Mongodb] is already declared; cannot redeclare at /tmp/vagrant-puppet/manifests/mongodb.pp:5 on node www

If I remove the configuration override it works perfectly but there's no reason why it doesn't.

like image 757
Josh Holloway Avatar asked Feb 01 '13 00:02

Josh Holloway


2 Answers

You are using two notations to achieve the same, but you can only use parameters with the second notation. In short, you are declaring it twice.

So, just lose 'include mongodb' and you're good.

More info: http://docs.puppetlabs.com/puppet/2.7/reference/lang_classes.html#declaring-a-class-with-include

like image 103
Ger Apeldoorn Avatar answered Sep 25 '22 01:09

Ger Apeldoorn


Yes, just simply remove include mongodb line. That will work, but make sure class { 'mongodb': ... } will still remain. Otherwise, use include mongodb

like image 44
Nino Paolo Avatar answered Sep 23 '22 01:09

Nino Paolo