Class: FtpVmRepository

Inherits:
VmRepository show all
Defined in:
lib/ovfparse/ftp_vmrepository.rb

Constant Summary

Constants inherited from VmRepository

VmRepository::ALLOWABLE_PKG_TYPES, VmRepository::ALLOWABLE_PROTOCOLS, VmRepository::STRICT_CHECKING, VmRepository::USE_CACHE

Instance Attribute Summary

Attributes inherited from VmRepository

#protocol, #repo, #url

Instance Method Summary collapse

Methods inherited from VmRepository

ESXParse, FTParse, HTTParse, LSParse, create, #initialize, #simplePackageConstruction, #uri

Constructor Details

This class inherits a constructor from VmRepository

Instance Method Details

#fetchObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ovfparse/ftp_vmrepository.rb', line 28

def fetch
  #retrieve data from ftp server
  raw_text_arr = get 

  if (raw_text_arr) 
    #parse out package list from index html
    package_list = VmRepository::FTParse(raw_text_arr)

    #construct package objects based on results
    return simplePackageConstruction(package_list)
  end
end

#getObject



18
19
20
21
22
23
24
25
26
# File 'lib/ovfparse/ftp_vmrepository.rb', line 18

def get 
  #TODO slap a '/' char on the end of self.uri if it doesn't have one, otherwise many servers return 403 
  ftp = Net::FTP.new(url.split("/", 2)[0], "anonymous", "[email protected]")
  ftp.passive = true
  ftp.chdir(url.split("/", 2)[1])
  raw_text_arr = ftp.list()
  ftp.quit()
  return raw_text_arr
end