Class: Chef::Provider::RemoteFile::NetworkFile
- Inherits:
-
Object
- Object
- Chef::Provider::RemoteFile::NetworkFile
- Defined in:
- lib/chef/provider/remote_file/network_file.rb
Instance Attribute Summary collapse
-
#new_resource ⇒ Object
readonly
Returns the value of attribute new_resource.
Instance Method Summary collapse
-
#fetch ⇒ Object
Fetches the file on a network share, returning a Tempfile-like File handle windows only.
-
#initialize(source, new_resource, current_resource) ⇒ NetworkFile
constructor
A new instance of NetworkFile.
Constructor Details
#initialize(source, new_resource, current_resource) ⇒ NetworkFile
Returns a new instance of NetworkFile.
30 31 32 33 |
# File 'lib/chef/provider/remote_file/network_file.rb', line 30 def initialize(source, new_resource, current_resource) @new_resource = new_resource @source = source end |
Instance Attribute Details
#new_resource ⇒ Object (readonly)
Returns the value of attribute new_resource.
28 29 30 |
# File 'lib/chef/provider/remote_file/network_file.rb', line 28 def new_resource @new_resource end |
Instance Method Details
#fetch ⇒ Object
Fetches the file on a network share, returning a Tempfile-like File handle windows only
37 38 39 40 41 42 43 |
# File 'lib/chef/provider/remote_file/network_file.rb', line 37 def fetch tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile Chef::Log.debug("#{new_resource} staging #{@source} to #{tempfile.path}") FileUtils.cp(@source, tempfile.path) tempfile.close if tempfile tempfile end |