Ask Your Question
1

Dependency not found

asked 2013-11-13 06:10:51 -0500

csdenboer gravatar image

I have the following class included in a node:

class syslog {
        package { 'rsyslog':
                ensure  => present,
                before  => [ File['syslogconf'], File['syslogconfint'], ],
        }

        if $::hasinternalip {
                file {'syslogconfint':
                        path    => '/etc/rsyslog.conf',
                        require => Package['rsyslog'],
                        source  => "puppet:///modules/syslog/rsyslogint.conf",
                }
        }
        else {
                file {'syslogconf':
                        path    => '/etc/rsyslog.conf',
                        require => Package['rsyslog'],
                        source  => "puppet:///modules/syslog/rsyslog.conf",
                }
        }

        service { 'rsyslog':
                ensure          => 'running',
                enable          => true,
                subscribe       => [ File['syslogconf'], File['syslogconfint'], ],
        }
}

When I try to apply the catalog Puppet gives me the following error:

Error: Failed to apply catalog: Could not find dependency File[syslogconfint] for Service[rsyslog] at /etc/puppet/modules/syslog/manifests/init.pp:26 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-11-13 08:08:21 -0500

golja gravatar image

Probably the IP is not internal so the File[syslogconfint] is never declared.

However there is no need to use different titles for your file syslogconf resource, as long you include it once.

Example how I would rewrite your module:

class syslog {
  package { 'rsyslog':
            ensure  => present,
            before  => File['syslogconf'],
  }

  if $::hasinternalip {
    $source_file = 'rsyslogint.conf'
  else {
    $source_file = 'rsyslog.conf'
  }

  file {'syslogconf':
    path    => '/etc/rsyslog.conf',
    require => Package['rsyslog'],
    source  => "puppet:///modules/syslog/${source_file}",
  }

  service { 'rsyslog':
    ensure      => 'running',
    enable     => true,
    subscribe => File['syslogconf'],
  }
}
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-11-13 06:10:51 -0500

Seen: 1,978 times

Last updated: Nov 13 '13