Method: Chef::Provider::Service::Arch#daemons

Defined in:
lib/chef/provider/service/arch.rb

#daemons {|entries| ... } ⇒ Object

Get list of all daemons from the file ‘/etc/rc.conf’. Mutiple lines and background form are supported. Example:

DAEMONS=(\
  foobar \
  @example \
  !net \
)

Yields:

  • (entries)


45
46
47
48
49
50
51
52
53
54
# File 'lib/chef/provider/service/arch.rb', line 45

def daemons
  entries = []
  if ::File.read("/etc/rc.conf").match(/DAEMONS=\((.*)\)/m)
    entries += $1.gsub(/\\?[\r\n]/, ' ').gsub(/# *[^ ]+/,' ').split(' ') if $1.length > 0
  end

  yield(entries) if block_given?

  entries
end