From 6524e3258c2eaaa1fb2123343480a6aacb705741 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Sun, 10 Aug 2014 10:41:53 +0100 Subject: [PATCH] Update providers for sabayon --- lib/puppet/provider/service/gentoo.rb | 50 -------------------------- lib/puppet/provider/service/sabayon.rb | 9 +++++ 2 files changed, 9 insertions(+), 50 deletions(-) delete mode 100644 lib/puppet/provider/service/gentoo.rb create mode 100644 lib/puppet/provider/service/sabayon.rb diff --git a/lib/puppet/provider/service/gentoo.rb b/lib/puppet/provider/service/gentoo.rb deleted file mode 100644 index b667b4b..0000000 --- a/lib/puppet/provider/service/gentoo.rb +++ /dev/null @@ -1,50 +0,0 @@ -# Manage gentoo services. Start/stop is the same as InitSvc, but enable/disable -# is special. -Puppet::Type.type(:service).provide :gentoo, :parent => :init do - desc "Gentoo's form of `init`-style service management. - - Uses `rc-update` for service enabling and disabling. - - " - - commands :update => "/sbin/rc-update" - - confine :operatingsystem => [ :gentoo, :sabayon ] - - defaultfor :operatingsystem => [ :gentoo, :sabayon ] - - def self.defpath - superclass.defpath - end - - def disable - output = update :del, @resource[:name], :default - rescue Puppet::ExecutionFailure - raise Puppet::Error, "Could not disable #{self.name}: #{output}" - end - - def enabled? - begin - output = update :show - rescue Puppet::ExecutionFailure - return :false - end - - line = output.split(/\n/).find { |l| l.include?(@resource[:name]) } - - return :false unless line - - # If it's enabled then it will print output showing service | runlevel - if output =~ /^\s*#{@resource[:name]}\s*\|\s*(boot|default)/ - return :true - else - return :false - end - end - - def enable - output = update :add, @resource[:name], :default - rescue Puppet::ExecutionFailure - raise Puppet::Error, "Could not enable #{self.name}: #{output}" - end -end diff --git a/lib/puppet/provider/service/sabayon.rb b/lib/puppet/provider/service/sabayon.rb new file mode 100644 index 0000000..eb63f98 --- /dev/null +++ b/lib/puppet/provider/service/sabayon.rb @@ -0,0 +1,9 @@ +# Manage systemd services using /bin/systemctl + +Puppet::Type.type(:service).provide :sabayon, :parent => :systemd do + desc "Manages `systemd` services using `systemctl`." + + defaultfor :operatingsystem => [:sabayon] + defaultfor :osfamily => :gentoo, :init => [:systemd] + +end