The error I was getting was due to duplicate declarations of the autofs 
class as follows.

```
29) dart::abstract::aos_master_node on fedora-26-x86_64 should contain 
Logrotate::Rule[httpd] with path => "/var/log/httpd/*log", missingok => 
true, ifempty => false, sharedscripts => true, delaycompress => false and 
postrotate => "/bin/systemctl reload httpd.service > /dev/null 2>/dev/null 
|| true"
      Failure/Error: include '::dart::subsys::autofs::common'
      
      Puppet::PreformattedError:
        Evaluation Error: Error while evaluating a Resource Statement, 
Duplicate declaration: Class[Autofs] is already declared; cannot redeclare 
(file: 
projects/puppet/modules/dart/spec/fixtures/modules/dart/manifests/subsys/autofs/common.pp,
 
line: 35) (file: 
projects/puppet/modules/dart/spec/fixtures/modules/dart/manifests/subsys/autofs/common.pp,
 
line: 35, column: 5) on node mdct-aos-master-f26.example.com
```

This occurs due to the dart::subsys::autofs::common class already being 
included by our base node class.  I've ran into this issue previously using 
resource-like declarations as well.
Adding the if !defined wrapper solves the issue but it still feels like a 
kludge instead of a proper solution.


On Thursday, August 9, 2018 at 3:33:47 PM UTC-4, Ben Ford wrote:
>
> Hi Michael. Can you share the code you tried and the errors you ran into?
>
> On Thu, Aug 9, 2018 at 11:30 AM Michael Watters <[email protected] 
> <javascript:>> wrote:
>
>> Hello,
>>
>> Is it possible to define metaparameters for a resource in Hiera?  For 
>> example, I have a class that is currently declared within another class as 
>> follows.
>>
>> if !defined(Class['autofs']) {
>>         class { 'autofs':
>>             require => [
>>                 Class['authconfig'],
>>                 Class['nfs::client'],
>>             ],
>>         }
>> }
>>
>> I would like to get rid of this mess and use a standard include statement 
>> with parameters defined in my common.yaml as follows.
>>
>> include 'autofs'
>>
>> ---
>> autofs::require:
>>     - "Class['authconfig']"
>>     - "Class['nfs::client']"
>>
>>
>> Will this work or do I have to stick with resource-like declarations to 
>> define dependencies?
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/ea13260d-673f-4322-a787-271c7f4b1259%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/puppet-users/ea13260d-673f-4322-a787-271c7f4b1259%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/98c525cc-4f3e-46d1-9f97-ff9a7c3adc76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to