On Friday, May 3, 2019 at 12:14:35 PM UTC-5, Stephen Marlow wrote:
>
> Hey Dan,
>
>   The error you're getting is just saying that you've declared the 
> Base::Systemusers class twice and a class can only be declared once.
>


No, not exactly. Puppet's diagnostic is deceiving here: classes may be 
declared any number of times, *BUT* only the first declaration evaluated 
may have the resource-like form, e.g.

class { 'base::systemusers': }

This is and always has been an excellent reason to avoid using 
resource-like declarations, of modules' public classes, though with care, 
you may use them inside a module for that module's private classes.  
Elsewhere, use include-like declarations instead:

include 'base::systemusers'

... and rely on automatic data binding for any needed parameter 
customization.

However, classes are idempotent.  Declaring the same class multiple times 
(in one of the allowed ways) has the same effect as declaring it just 
once.  That is in fact one of the reasons why only the first-evaluated 
declaration of a given class may take the resource-like form.

 

>   If that is the case then you should be able to fix the problem by 
> changing Base::Systemusers from a class to a define.
>


Yes, the OP appears to want a defined type here, not a class, because they 
appear specifically to want non-idempotency.  This goes straight to the 
difference between classes and defined types.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3832f918-587e-4459-b790-6e738650fc13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to