We created a new service provider for Puppet. However, when using that provider the service keeps getting (re-)enabled with every Puppet run:
Notice: /Stage[main]/Profiles::Base/Service[foo]/enable: enable changed 'true' to 'true'
Debug output shows that the service already is enabled (and running), but it's still getting enabled again:
Debug: Executing: '/usr/bin/svctl isup foo'
Debug: foo is running
Debug: Executing: '/usr/bin/svctl isenabled foo'
Debug: foo is enabled
Debug: Executing: '/usr/bin/svctl enable foo'
Debug: Executing: '/usr/bin/svctl update'
Debug: foo has been enabled
Notice: /Stage[main]/Profiles::Base/Service[foo]/enable: enable changed 'true' to 'true'
These are the relevant parts of the provider code:
commands :svctl => "svctl"
# ...
def enabled?
begin
svctl(["isenabled", @resource[:name]])
return true
rescue Puppet::ExecutionFailure => e
if $?.exitstatus == 1
return false
else
return nil
end
end
end
def enable
begin
svctl(["enable", @resource[:name]])
self.updatecmd
rescue Puppet::ExecutionFailure => e
return nil
end
end