Class: Chef::Provider::Script

Inherits:
Execute show all
Defined in:
lib/chef/provider/script.rb

Instance Attribute Summary

Attributes inherited from Chef::Provider

#current_resource, #new_resource, #node

Instance Method Summary collapse

Methods inherited from Execute

#load_current_resource

Methods included from Mixin::Command

handle_command_failures, not_if, only_if, output_of_command, popen4, run_command, run_command_with_systems_locale

Methods inherited from Chef::Provider

#action_nothing, build_from_file, #initialize, #load_current_resource

Methods included from Mixin::ConvertToClassName

#convert_to_class_name, #convert_to_snake_case, #filename_to_qualified_string

Methods included from Mixin::RecipeDefinitionDSLCore

#method_missing

Methods included from Mixin::Language

#data_bag, #data_bag_item, #platform?, #search, #value_for_platform

Constructor Details

This class inherits a constructor from Chef::Provider

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Chef::Mixin::RecipeDefinitionDSLCore

Instance Method Details

#action_runObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/chef/provider/script.rb', line 26

def action_run  
  tf = Tempfile.new("chef-script")
  tf.puts(@new_resource.code)
  tf.close
  
  fr = Chef::Resource::File.new(tf.path, nil, @node)
  fr.owner(@new_resource.user)
  fr.group(@new_resource.group)
  fr.run_action(:create)
  
  @new_resource.command("#{@new_resource.interpreter} #{tf.path}") 
  super
end