Issue #5447 has been updated by Eric Pratt.

I'm not sure the resolution of this was correct.  It looks like this is marked 
as a duplicate of a bug where people were using '-' characters in variable 
names.  While the last example in the comments did do this, the original 
manifests posted in the opening ticket and early comments did not.

I just encountered this problem last night for the first time and rearranging 
the order of content in a manifest did indeed fix the problem.  I never use '-' 
characters in variable names and have none in my manifest.  'puppet agent' gave 
me this error:

<pre>
err: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Duplicate definition: Class[System::Yumrepos] is already defined; cannot 
redefine at /path/to/puppet/modules/system/manifests/init.pp:60 on node 
nodename.domain
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
</pre>

The manifest in question is below.  In this manifest, if I move the 
"system::yumrepos" class call above the "Dell Configuration" section then the 
error goes away.  There are two confusing issues about this error.  The first 
is that in this manifest I'm really not defining the class "system::yumrepos", 
only calling it.  The second is that it says it's already defined but doesn't 
tell me where it was defined.  I'm also a little perplexed that changing the 
order of the manifest's contents matters.

<pre>
class system (
        $atrpms_repo_enabled = false,
        $cluster = false,
        $jenkins_repo_enabled = false,
        $type = 'vm'
){

        include system::params
        include system::environment

###
### Dell Configuration
###

        if $type == 'dell' {

                $dell_repo_enabled = true

                package { 'srvadmin-all':
                        ensure => installed,
                        require => Class['system::yumrepos'],
                }

                service { [ 'instsvcdrv', 'dataeng', 'dsm_om_shrsvc', 
'dsm_om_connsvc' ]:
                        ensure => running,
                        enable => true,
                        require => Package['srvadmin-all'],
                }

        } else {

                $dell_repo_enabled = false

        }

###
### Cluster Configuration
###

        if $cluster == true {

                $clusterlabs_repo_enabled = true

                class { 'system::cluster':
                        require => Class['system::yumrepos']
                }

        } else {

                $clusterlabs_repo_enabled = false

        }

###
### Yum Repository Configuration
###

        class { 'system::yumrepos':
                dell_repo_enabled => $dell_repo_enabled,
                atrpms_repo_enabled => $atrpms_repo_enabled,
                clusterlabs_repo_enabled => $clusterlabs_repo_enabled,
                jenkins_repo_enabled => $jenkins_repo_enabled,
        }

}
</pre>
----------------------------------------
Bug #5447: Fix duplicate definition error
https://projects.puppetlabs.com/issues/5447#change-65540

Author: Matt Robinson
Status: Duplicate
Priority: Normal
Assignee: James Turnbull
Category: parser
Target version: 
Affected Puppet version: 2.7.6
Keywords: parameterized_classes
Branch: 


Jos Boumans reported a manifest that results in the following error:

Duplicate definition: Class[Kbase] is already defined; cannot redefine at 
/Users/matthewrobinson/work/puppet/4792:5 on node mattmac.puppetlabs.lan

He thought this was related to ticket 4792 and thus reopened it, but it appears 
to be a separate issue.  He posted his full set of manifests on that ticket, 
but we reduced that to a much smaller manifest that reproduces the problem:
    
<pre>

class { "s_riak": }

class s_riak inherits kbase { }

class { "kbase": }

class kbase { }
</pre>

Note that no external node classification or anything fancy was involved, you 
should be able to reproduce the error on this manifest by simply running it 
through puppet apply.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to