Sha256: 919a1744802c11dfe3836f244553b8da52c928c0643e7c9e32103a1c69024aa4

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 KB

Contents

#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require 'tempfile'
require 'chef/provider/execute'

class Chef
  class Provider
    class Script < Chef::Provider::Execute
      
      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
      
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
chef-0.8.10 lib/chef/provider/script.rb
chef-0.8.8 lib/chef/provider/script.rb
chef-0.8.6 lib/chef/provider/script.rb
chef-0.8.4 lib/chef/provider/script.rb
chef-0.8.2 lib/chef/provider/script.rb
runa-chef-0.8.0.1 lib/chef/provider/script.rb
chef-0.7.16 lib/chef/provider/script.rb
giraffesoft-chef-0.7.16 lib/chef/provider/script.rb
giraffesoft-chef-0.7.15 lib/chef/provider/script.rb
chef-0.7.14 lib/chef/provider/script.rb
chef-0.7.12 lib/chef/provider/script.rb
chef-0.7.10 lib/chef/provider/script.rb