On Mar 9, 10:15 pm, Len Rugen <[email protected]> wrote:
> We seem to be getting intermittent errors production this message.
>
> err: Failed to apply catalog: Could not find dependency
> Package[zabbix-agent] for Service[undef] at
> /etc/puppet/modules/zabbix-agent/manifests/init.pp:76
>
> It will usually work OK on the next rerun.


That sounds like a parse-order problem.  At the time the Service
declaration is parsed, Package[zabbix-agent] has not (yet) been
declared for the node.


>  The class is addressing a
> service that was zabbix-agent prior to version 1.8.9 but was renamed to
> zabbix-agent.  I am puzzled that "undef" can result in the if / else as
> it's set in either case.   (Copy paste changed some indentation)
>
> Puppet version is 2.7.9, OS RHEL, some 5 and 6, which doesn't seem to
> matter, and the error occurs on hosts running either zabbix version.
>
> Any thoughts?  Doc follows
>
> This uses a custom fact:
>
> Facter.add(:zabbix_version) do
>   setcode do
>     output = %x{/bin/rpm -qa --queryformat "%{VERSION}" zabbix-agent}
>   end
> end
>
> Parts of the manifest
> <snip>
>
> if versioncmp($zabbix_version, '1.8.9') >= 0 {
>         $packages = [ "zabbix-agent", "zabbix-get", "zabbix-sender" ]
>         $agent = "zabbix-agentd" }
> else {
>         $packages = [ "zabbix-agent" ]
>     $agent = "zabbix-agent"
>
> }
>
> <snip>
>     service {
>         $agent:
>             enable => true,
>             ensure => running,
>             hasstatus => true,
>             require => Package["zabbix-agent"];
>     }    # This is line 76


The bit about "Service[undef]" in your log also suggests an ordering
issue.  I conclude that the two manifest fragments you present are at
least in different classes, if not different files, and that
occasionally puppet tries to parse the latter class before parsing a
declaration (not definition) of the former.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" 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-users?hl=en.

Reply via email to