Class: PuppetX::Bodeco::FTP

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_x/bodeco/util.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, options) ⇒ FTP

Returns a new instance of FTP.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/puppet_x/bodeco/util.rb', line 148

def initialize(url, options)
  require 'net/ftp'

  uri = URI(url)
  username = options[:username]
  password = options[:password]
  proxy_server = options[:proxy_server]
  proxy_type = options[:proxy_type]

  ENV["#{proxy_type}_proxy"] = proxy_server

  @ftp = Net::FTP.new
  @ftp.connect(uri.host, uri.port)
  if username
    @ftp.(username, password)
  else
    @ftp.
  end
end

Instance Method Details

#download(uri, file_path) ⇒ Object



168
169
170
# File 'lib/puppet_x/bodeco/util.rb', line 168

def download(uri, file_path)
  @ftp.getbinaryfile(uri.path, file_path)
end