problem with restart a service when a file changes

349 views
Skip to first unread message

Kazor

unread,
Dec 26, 2012, 5:13:44 PM12/26/12
to puppet...@googlegroups.com
Hello,
I have problem with my class when the archive is changed and the service is not restarted when i apply change and run the puppet agent, I have the next error:

[..............]
 err: /Stage[main]/Spam_rule/Exec[zmamavisdctl]: Failed to call refresh: /opt/zimbra/bin/zmamavisdctl returned 1 instead of one of [0] at /etc/puppet/modules/spam_rule/manifests/init.pp:25 
[..............]

Note: The change that i written in the archive (/etc/puppet//modules/spam_rule/99_rules.cf) is applied to puppet agent the problem is only refresh (restart) to resource.


My class is "spam_rule" (/etc/puppet/modules/spam_rule/manifests/init.pp)

[..............]
class spam_rule {

if $TypeSrv == "zimbra" {

# global perms
File {
  owner => zimbra,
  group => zimbra,
  mode  => 644,
}

# create rule archive
file { "/opt/zimbra/conf/spamassassin/99_rule.cf":
    ensure => file,
    source => "puppet:///modules/spam_rule/99_rules.cf",
   # notify  => Exec["zmamavisdctl"],
}


# define the service to restart
exec { "zmamavisdctl":
    refreshonly => true,
    command => "/opt/zimbra/bin/zmamavisdctl",
    subscribe => File["/opt/zimbra/conf/spamassassin/99_rules.cf"],
}

}

else{

# globals perms
File {
  owner => mailcleaner,
  group => mailcleaner,
  mode  => 644,
}

# create rules archive
file { "/usr/mailcleaner/share/spamassassin/99_rules.cf":
    ensure => file,
    source => "puppet:///modules/spam_rule/99_rules.cf",
 }

# service restart
exec { "mailscanner":
    refreshonly => true,
    command => "/usr/mailcleaner/etc/init.d/mailscanner",
    subscribe => File["/usr/mailcleaner/share/spamassassin/99_rules.cf"],
}

}
 
}

[..............]


My site.pp (/etc/puppet/manifests/)

[..............]


#all mailcleaner  
server
node /^mailcleaner.*$/ {
$TypeSrv="mailcleaner"
include spam_rule
}

        $TypeSrv="zimbra"
include spam_rule

}

[..............]

¿Some suggestion?


Thanks

joe

unread,
Dec 26, 2012, 9:11:44 PM12/26/12
to puppet...@googlegroups.com
What it's telling you is that the command it's running (zmamavisdctl) is spitting out a return code of 1, which typically means that there was an error running the script.

Either the command is actually failing, or the command is poorly written and does not provide the correct return code.

This is not actually a problem with puppet at all.

Kazor

unread,
Dec 28, 2012, 8:21:15 AM12/28/12
to puppet...@googlegroups.com
Thaks Joe,
My problem was the sintax on command that was not correct, i solved this and the agent running without problem. 

[...........]

# define the service to restart
exec { "zmamavisdctl":
    user        => 'zimbra',
    refreshonly => true,
    command     => '/opt/zimbra/bin/zmantispamctl restart',
    subscribe   => File["/opt/zimbra/conf/spamassassin/99_spam_rules"],
}

[...........]

Best regards!
Reply all
Reply to author
Forward
0 new messages