class Chef::Provider::RemoteFile::Fetcher
Public Class Methods
for_resource(uri, new_resource, current_resource)
click to toggle source
# File lib/chef/provider/remote_file/fetcher.rb, line 25 def self.for_resource(uri, new_resource, current_resource) if network_share?(uri) if !Chef::Platform.windows? raise Exceptions::UnsupportedPlatform, "Fetching the file on a network share is supported only on the Windows platform. Please change your source: #{uri}" end Chef::Provider::RemoteFile::NetworkFile.new(uri, new_resource, current_resource) else case uri.scheme when "http", "https" Chef::Provider::RemoteFile::HTTP.new(uri, new_resource, current_resource) when "ftp" Chef::Provider::RemoteFile::FTP.new(uri, new_resource, current_resource) when "sftp" Chef::Provider::RemoteFile::SFTP.new(uri, new_resource, current_resource) when "file" Chef::Provider::RemoteFile::LocalFile.new(uri, new_resource, current_resource) else raise ArgumentError, "Invalid uri, Only http(s), ftp, and file are currently supported" end end end