class Fission::Action::VM::Cloner

def clean_up_conf_file(conf_file_path)

Returns nothing.

@cloner.clean_up_conf_file '/vms/foo/foo.vmx'

Examples

conf_file_path - Aboslute path to the VM's conf file (.vmx).

and disable VMware tools warning.
includes removing generated MAC addresses, setting up for a new UUID,
Internal: Cleans up the conf file (*.vmx) for a newly cloned VM. This
def clean_up_conf_file(conf_file_path)
  conf_items_patterns = { /^tools\.remindInstall.*\n/ => "tools.remindInstall = \"FALSE\"",
    /^uuid\.action.*\n/ => "uuid.action = \"create\"",
    /^ethernet\.+generatedAddress.*\n/ => '' }
  content = File.read conf_file_path
  content << "\n"
  conf_items_patterns.each_pair do |pattern, new_item|
    unless content.include? new_item
      content.gsub(pattern, '').strip
      content << "#{new_item}\n"
    end
  end
  File.open(conf_file_path, 'w') { |f| f.print content }
end