Files

Class/Module Index [+]

Quicksearch

Chef::Provider::Script

Public Instance Methods

action_run() click to toggle source
# File lib/chef/provider/script.rb, line 26
def action_run
  script_file.puts(@new_resource.code)
  script_file.close

  set_owner_and_group

  @new_resource.command("\"#{@new_resource.interpreter}\" #{@new_resource.flags} \"#{script_file.path}\"")
  super
  converge_by(nil) do
    # ensure script is unlinked at end of converge!
    unlink_script_file
  end
end
script_file() click to toggle source
# File lib/chef/provider/script.rb, line 47
def script_file
  @script_file ||= Tempfile.open("chef-script")
end
set_owner_and_group() click to toggle source
# File lib/chef/provider/script.rb, line 40
def set_owner_and_group
  # FileUtils itself implements a no-op if +user+ or +group+ are nil
  # You can prove this by running FileUtils.chown(nil,nil,'/tmp/file')
  # as an unprivileged user.
  FileUtils.chown(@new_resource.user, @new_resource.group, script_file.path)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.