methods/vf_common.rb
# Create VMware Fusion VM vmx file
Create VMware Fusion VM vmx file
Create VMware Fusion VM vmx file
def create_fusion_vm_vmx_file(options,fusion_vmx_file)
  if options['os-type'] == options['empty']
    options['os-type'] = get_fusion_guest_os(options)
  end
  vmx_info = populate_fusion_vm_vmx_info(options)
  if not fusion_vmx_file.match(/\/packer\//)
    fusion_vm_dir,fusion_vmx_file,fusion_disk_file = check_fusion_vm_doesnt_exist(options)
  else
    fusion_vm_dir = File.dirname(fusion_vmx_file)
  end
  file = File.open(fusion_vmx_file,"w")
  if options['verbose'] == true
    handle_output(options,"Information:\tChecking Fusion VMX configuration directory")
  end
  check_dir_exists(options,fusion_vm_dir)
  uid = options['uid']
  check_dir_owner(options,fusion_vm_dir,uid)
  vmx_info.each do |vmx_line|
    (vmx_param,vmx_value) = vmx_line.split(/\,/)
    if not vmx_value
      vmx_value = ""
    end
    output = vmx_param+" = \""+vmx_value+"\"\n"
    file.write(output)
  end
  file.close
  print_contents_of_file(options,"",fusion_vmx_file)
  return
end
def create_fusion_vm_vmx_file ( options , fusion_vmx_file ) if options [ 'os-type' ] == options [ 'empty' ] options [ 'os-type' ] = get_fusion_guest_os ( options ) end vmx_info = populate_fusion_vm_vmx_info ( options ) if not fusion_vmx_file . match ( / \/ packer \/ / ) fusion_vm_dir , fusion_vmx_file , fusion_disk_file = check_fusion_vm_doesnt_exist ( options ) else fusion_vm_dir = File . dirname ( fusion_vmx_file ) end file = File . open ( fusion_vmx_file , "w" ) if options [ 'verbose' ] == true handle_output ( options , "Information:\tChecking Fusion VMX configuration directory" ) end check_dir_exists ( options , fusion_vm_dir ) uid = options [ 'uid' ] check_dir_owner ( options , fusion_vm_dir , uid ) vmx_info . each do | vmx_line | ( vmx_param , vmx_value ) = vmx_line . split ( / \, / ) if not vmx_value vmx_value = "" end output = vmx_param + " = \"" + vmx_value + "\"\n" file . write ( output ) end file . close print_contents_of_file ( options , "" , fusion_vmx_file ) return end
Create VMware Fusion VM vmx file
Create VMware Fusion VM vmx file
options
<not_specific>
fusion_vmx_file
<not_specific>