Class: FileVmRepository

Inherits:
VmRepository show all
Defined in:
lib/ovfparse/file_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



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ovfparse/file_vmrepository.rb', line 33

def fetch 
    #retrieve data from file system 
    raw_file_list = get

    #parse out package list
    #if linux 
    package_list = VmRepository::LSParse(raw_file_list)
    #if windows 
    #package_list = Repository::DIRParse(file_list)
  
    #construct package objects based on results
    return simplePackageConstruction(package_list)
end

#getObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ovfparse/file_vmrepository.rb', line 17

def get 
  #TODO slap a '/' char on the end of self.uri if it doesn't have one, otherwise many servers return 403 
  #if linux
  $cmd = "ls " + @url
  #if windows
  #$cmd = "dir " + url
  #

  pipe = IO.popen $cmd
  raw_file_list = pipe.read
  pipe.close
    
  return raw_file_list 
end