Class: FtpVmPackage

Inherits:
VmPackage show all
Defined in:
lib/ovfparse/vmpackage.rb

Constant Summary

Constants inherited from VmPackage

VmPackage::DEBUG_MODE, VmPackage::ISO, VmPackage::OVA, VmPackage::OVF, VmPackage::OVF_NAMESPACE, VmPackage::PRODUCT_ATTRIBUTES, VmPackage::PRODUCT_ELEMENTS, VmPackage::PROPERTY_ATTRIBUTES, VmPackage::PROPERTY_ELEMENTS

Instance Attribute Summary

Attributes inherited from VmPackage

#base_path, #diskSection, #name, #networkSection, #protocol, #references, #size, #state, #url, #version, #virtualSystem, #xml

Instance Method Summary collapse

Methods inherited from VmPackage

#buildNewIDEController, #checkschema, construct_skeleton, create, #getChildByName, #getChildrenByName, #getFirstOpenIDEAddress, #getOpenChannelOnIDEController, #getVirtualQuantity, #getVmAttributes, #getVmCPUs, #getVmDescription, #getVmDisks, #getVmName, #getVmNetworks, #getVmOS, #getVmOS_ID, #getVmPatchLevel, #getVmRAM, #getVmReferences, #initialize, #loadElementRefs, #method_missing, #referenced_file, #removeDisksFromVirtualHardwareSection, #removeNetworksFromVirtualHardwareSection, #setAttributes, #setElements, #setProductIcon, #setPropertyDefault, #setVirtualQuantity, #setVmAttributes, #setVmCPUs, #setVmDescription, #setVmDisks, #setVmName, #setVmNetworks, #setVmOS_ID, #setVmPatchlevel, #setVmRAM, #sign, #to_s, #uri, #writeXML, #xpath

Constructor Details

This class inherits a constructor from VmPackage

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VmPackage

Instance Method Details

#fetchObject



725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
# File 'lib/ovfparse/vmpackage.rb', line 725

def fetch 
  url = URI.parse(URI.escape(self.uri))
  ftp = Net::FTP.new(url.host, "anonymous", "[email protected]")
    ftp.passive = true
    ftp.getbinaryfile(url.path, @name, 1024)
  ftp.quit()

  @xml = Nokogiri::XML(File.open(@name)) do |config|
    config.strict.noent
    config.strict
  end

  File.unlink(@name)   
  loadElementRefs
end