class Fission::Metadata
def self.delete_vm_info(vm_path)
Fission::Metadata.delete_vm_info '/vms/foo.vmwarevm'
Examples
vm_path - The absolute path to the directory of a VM.
in the Fusion GUI.
will recreate the metadata which is deleted. This leads to 'missing' VMs
running this method should succeed, but it's been observed that Fusion
method without the Fusion GUI application running. If the Fusion GUI is
running when this method is called. It's highly recommended to call this
Public: Deletes the Fusion metadata related to a VM. The VM should not be
def self.delete_vm_info(vm_path) metadata = new metadata.load metadata.delete_vm_restart_document(vm_path) metadata.delete_vm_favorite_entry(vm_path) metadata.save end
def delete_vm_favorite_entry(vm_path)
metadata.delete_favorite_entry '/vms/foo.vmwarevm'
Examples
vm_path - The absolute path to the directory of a VM.
libarary.
The 'favorites list' dictates which VMs are displayed in the Fusion VM
Public: Deletes the VM information from the 'favorites list' metadata.
def delete_vm_favorite_entry(vm_path) if @content.has_key?('VMFavoritesListDefaults2') @content['VMFavoritesListDefaults2'].delete_if { |vm| vm['path'] == vm_path } end if @content.has_key?('fusionInitialSessions') @content['fusionInitialSessions'].delete_if {|vm| vm['documentPath'] == vm_path} end end
def delete_vm_restart_document(vm_path)
metadata.delete_vm_restart_document 'vms/foo.vmwarevm'
Examples
vm_path - The absolute path to the directory of a VM.
display when Fusion starts.
metadata. The 'restart document path' dictates which GUI consoles to
Public: Deletes the VM information from the 'restart document path'
def delete_vm_restart_document(vm_path) if @content.has_key?('PLRestartDocumentPaths') @content['PLRestartDocumentPaths'].delete_if { |p| p == vm_path } end end
def load
metadata.load
Examples
variable with native ruby types.
Public: Reads the configured metadata file and populates the content
def load raw_data = CFPropertyList::List.new :file => Fission.config['plist_file'] @content = CFPropertyList.native_types raw_data.value end
def save
metadata.save
Examples
content variable.
Public: Saves a new version of the metadata file with the data in the
def save new_content = CFPropertyList::List.new new_content.value = CFPropertyList.guess @content new_content.save Fission.config['plist_file'], CFPropertyList::List::FORMAT_BINARY end