example42 / puppet-php

A puppet module for php. According to Example42 NextGen spec.
Other
45 stars 62 forks source link

Duplicate class declaration error #43

Open bmcclure opened 10 years ago

bmcclure commented 10 years ago

I'm not positive where this problem comes from, it may not be related to this module, but I figured I'd post here to get your opinion.

I'm using the latest version of this module. I use Foreman as my ENC. At some point recently, I started getting duplicate class declaration errors for Class[php]. The only place the class is declared parameterized that I can find is via Foreman.

Normally newer versions of puppet would provide the file in which the duplicate declaration occurred, but apparently since I'm using an ENC it is not specific.

I tried commenting out all 'include php' declarations from all classes in this module, but the error didn't go away. Only removing the php class from this server in Foreman makes the error go away.

Do you have any ideas where any other declarations of the 'php' class might be coming from or what else could cause this error with Puppet 3.4.2?

Again, I'm not sure this is even an issue with this module, but I just can't find anything else that would cause this error so I figured I'd check.

bmcclure commented 10 years ago

I found out the issue--apparently it was that I was also including the php::pear class, which inherits php. This must have been seen as the duplicate class declaration, as the error went away when I stopped calling php::pear. Now to figure out how to properly include both php and php::pear from Foreman...

alvagante commented 10 years ago

The "inherits php" is not needed there. An include php should be placed in php::pear , instead, so such a change would be accepted, but it would not probably solve your issue if you declare the php class somewhere else. You might just include php , where you need it, without using the class { 'php': } declaration style (or without providing direct parameters via the enc). I prefer not to remove both the inherits and the alternative include from php::pear because that would break setups where people use directly the php::pear:: defines without explicitly including the main php class.

bmcclure commented 10 years ago

Thanks for the info!

Personally, I think an 'include php' would be preferable. Even though the puppet docs say not to mix include-style and declaration-style classes because the behavior is undefined, including the class in my ENC seems to work fine even with all the 'include php' lines already in the module, and only breaks when I call the php::pear class which currently inherits php.