Class: Chef::Provider::RemoteFile::FTP
- Inherits:
-
Object
- Object
- Chef::Provider::RemoteFile::FTP
- Defined in:
- lib/chef/provider/remote_file/ftp.rb
Instance Attribute Summary collapse
-
#current_resource ⇒ Object
readonly
Returns the value of attribute current_resource.
-
#new_resource ⇒ Object
readonly
Returns the value of attribute new_resource.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #directories ⇒ Object
- #fetch ⇒ Object
- #filename ⇒ Object
- #ftp ⇒ Object
- #hostname ⇒ Object
-
#initialize(uri, new_resource, current_resource) ⇒ FTP
constructor
A new instance of FTP.
- #pass ⇒ Object
- #port ⇒ Object
- #typecode ⇒ Object
- #use_passive_mode? ⇒ Boolean
- #user ⇒ Object
Constructor Details
#initialize(uri, new_resource, current_resource) ⇒ FTP
Returns a new instance of FTP.
34 35 36 37 38 39 40 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 34 def initialize(uri, new_resource, current_resource) @uri = uri @new_resource = new_resource @current_resource = current_resource validate_typecode! validate_path! end |
Instance Attribute Details
#current_resource ⇒ Object (readonly)
Returns the value of attribute current_resource.
32 33 34 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 32 def current_resource @current_resource end |
#new_resource ⇒ Object (readonly)
Returns the value of attribute new_resource.
31 32 33 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 31 def new_resource @new_resource end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
30 31 32 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 30 def uri @uri end |
Instance Method Details
#directories ⇒ Object
74 75 76 77 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 74 def directories parse_path if @directories.nil? @directories end |
#fetch ⇒ Object
84 85 86 87 88 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 84 def fetch with_connection do get end end |
#filename ⇒ Object
79 80 81 82 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 79 def filename parse_path if @filename.nil? @filename end |
#ftp ⇒ Object
90 91 92 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 90 def ftp @ftp ||= Net::FTP.new end |
#hostname ⇒ Object
42 43 44 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 42 def hostname @uri.host end |
#pass ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 66 def pass if uri.userinfo URI.unescape(uri.password) else nil end end |
#port ⇒ Object
46 47 48 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 46 def port @uri.port end |
#typecode ⇒ Object
54 55 56 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 54 def typecode uri.typecode end |
#use_passive_mode? ⇒ Boolean
50 51 52 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 50 def use_passive_mode? ! new_resource.ftp_active_mode end |
#user ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/chef/provider/remote_file/ftp.rb', line 58 def user if uri.userinfo URI.unescape(uri.user) else "anonymous" end end |