DanH
DanH

Reputation: 5818

Error: Could not apply complete catalog: Found 1 dependency cycle

When running the following command :

puppet apply --verbose /etc/puppet/manifests/sites.pp/site1.pp

I get the error:

Error: Could not apply complete catalog: Found 1 dependency cycle:
(File[/etc/postfix] => File[/etc/postfix])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz

Here's the related manifest/modules:

/etc/puppet/modules/postfix/manifests/init.pp:

class postfix {

    package { 'postfix' :
        ensure => present
    }

    file { '/etc/postfix' :
        path => "/etc/postfix/main.cf",
        ensure => present,
        content => template("postfix/main.cf.erb"),
        subscribe => Package['postfix']
    }

}

/etc/puppet/manifests/sites.pp/site1.pp:

class site1 {

    include apache2
    include essentials
    include mysql
    include python2
    include postfix
}

There's no other mention of postfix in any of the other modules, and removing the include postfix allows the full puppet apply to proceed, so I'm supposing it is self contained.

I've also tried removing the template and putting placeholder content in the module itself, to no change.

Upvotes: 0

Views: 1409

Answers (1)

Raul Andres
Raul Andres

Reputation: 3806

For some reason you are using a path different than resource name. That causes an autoinclude of self, and a circular dependency.

file { '/etc/postfix' :
    ensure=>directory
}
file { '/etc/postfix/main.cf':
    ensure => present,
    content => template("postfix/main.cf.erb"),
    subscribe => Package['postfix']
}

Will solve your issue

Upvotes: 3

Related Questions