Promote Sabayon to a fully supported OS with package and service resource support
This commit is contained in:
13
lib/facter/operatingsystem.rb
Normal file
13
lib/facter/operatingsystem.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
require 'facter/lsb'
|
||||
|
||||
Facter.add(:operatingsystem) do
|
||||
confine :kernel => :linux
|
||||
confine :has_entropy => true
|
||||
|
||||
setcode do
|
||||
if FileTest.exists?("/etc/sabayon-release")
|
||||
"Sabayon"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,9 +11,9 @@ Puppet::Type.type(:package).provide :entropy, :parent => Puppet::Provider::Packa
|
||||
|
||||
commands :equo => "/usr/bin/equo"
|
||||
|
||||
#confine :operatingsystem => [ :gentoo, :sabayon ]
|
||||
|
||||
defaultfor :has_entropy => true
|
||||
confine :operatingsystem => :sabayon
|
||||
|
||||
defaultfor :operatingsystem => :sabayon
|
||||
|
||||
def self.instances
|
||||
result_format = /^(\S+)\/(\S+)-([\.\d]+(?:_(?:alpha|beta|pre|rc|p)\d+)?(?:-r\d+)?)$/
|
||||
|
||||
50
lib/puppet/provider/service/gentoo.rb
Normal file
50
lib/puppet/provider/service/gentoo.rb
Normal file
@@ -0,0 +1,50 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user