class RcLocal

Public Instance Methods

deploy() click to toggle source
# File lib/dust/recipes/rc_local.rb, line 3
def deploy

  if @node.uses_apt?
    @node.messages.add("configuring custom startup script\n")

    rc = ''
    Array(@config).each do |cmd|
      msg = @node.messages.add("adding command: #{cmd}", :indent => 2)
      rc << "#{cmd}\n"
      msg.ok
    end
    rc << "\nexit 0\n"

    @node.write '/etc/rc.local', rc
    @node.chown 'root:root', '/etc/rc.local'
    @node.chmod '755', '/etc/rc.local'
  else
    @node.messages.add('os not supported').failed
  end
end
status() click to toggle source
# File lib/dust/recipes/rc_local.rb, line 25
def status
  msg = @node.messages.add('getting /etc/rc.local')
  ret = @node.exec 'cat /etc/rc.local'
  msg.parse_result(ret[:exit_code])
  msg.print_output(ret)
end