From 9b6966aa6b2b3c3a6876db1e2788d93f90899fa8 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Wed, 4 Oct 2017 14:31:23 -0500 Subject: [PATCH] Block enabling of services --- lib/puppet/provider/service/redhat.rb | 7 ++++--- lib/puppet/provider/service/systemd.rb | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb index 4f3f9b8..fe3723f 100644 --- a/lib/puppet/provider/service/redhat.rb +++ b/lib/puppet/provider/service/redhat.rb @@ -7,6 +7,7 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init " commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service" + commands :noop => "/bin/true" defaultfor :osfamily => :redhat defaultfor :osfamily => :suse, :operatingsystemmajrelease => ["10", "11"] @@ -42,10 +43,10 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init # Don't support them specifying runlevels; always use the runlevels # in the init scripts. def enable - chkconfig("--add", @resource[:name]) - chkconfig(@resource[:name], :on) + # Do not enable services + noop(@resource[:name]) rescue Puppet::ExecutionFailure => detail - raise Puppet::Error, "Could not enable #{self.name}: #{detail}", detail.backtrace + raise Puppet::Error, "Could not enable #{self.name}", detail.backtrace end def initscript diff --git a/lib/puppet/provider/service/systemd.rb b/lib/puppet/provider/service/systemd.rb index a673550..a4deed4 100644 --- a/lib/puppet/provider/service/systemd.rb +++ b/lib/puppet/provider/service/systemd.rb @@ -8,6 +8,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do providing the proper suffix." commands :systemctl => "systemctl" + commands :noop => "/bin/true" if Facter.value(:osfamily).downcase == 'debian' # With multiple init systems on Debian, it is possible to have @@ -118,7 +119,8 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do def enable self.unmask - systemctl_change_enable(:enable) + #systemctl_change_enable(:enable) + [command(:noop), @resource[:name]] end def mask -- 1.8.3.1