Ask Your Question

PE 3.7 Including puppet_enterprise class leads to duplicate declaration error

asked 2014-11-23 04:52:31 -0600

ripzura gravatar image

When I create the following mock class in PE 3.7

class myclass { include puppet_enterprise }

And include this class on a node I get the following error when running the agent on that node.

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Class[Puppet_enterprise] is already declared; cannot redeclare on node ...

according to the documentation the include function should only declare classes if they have not allready been declared.

Anyone got an idea what is happening here?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-11-23 23:54:17 -0600

llowder gravatar image

The include function will work that way if you only use include.

If you mix include and resource syntax ( class { 'foo': ... }) then you may, or may not get a duplicate resource error depending on what gets parsed first.

I suspect that somewhere (probably within the set of modules that PE uses) there is a class {'puppet_enterprise': ... } declaration.

If you are still not able to track it down, please contact Support if you have a support contract, or your sales person if you have not yet purchased. In either case, you'll be able to get additional assistance if needed.

edit flag offensive delete link more

answered 2014-11-24 11:15:27 -0600

nrvale0 gravatar image

updated 2014-11-24 11:15:53 -0600

Fairly certain 'puppet_enterprise' class is auto-classified in PE and thus you can avoid getting into this situation by not doing the include yourself. A hacky work-around if you REALLY want to be explicit about that class would be:

if !defined(Class['::puppet_enterprise']) {   
    include ::puppet_enterprise
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-11-23 04:52:31 -0600

Seen: 194 times

Last updated: Nov 24 '14