arista-eosplus / packer-ztpserver

Packer.io set up of ZTP server
18 stars 9 forks source link

"create-ztpserver.py virtualbox eos" fails on OS X, but VM created ok #8

Closed advornic closed 9 years ago

advornic commented 9 years ago
    virtualbox-iso-eos: The system is going down for power-off NOW!
    virtualbox-iso-eos:
    virtualbox-iso-eos:
    virtualbox-iso-eos:
==> virtualbox-iso-eos: Preparing to export machine...
    virtualbox-iso-eos: Deleting forwarded port mapping for SSH (host port 2315)
==> virtualbox-iso-eos: Exporting virtual machine...
    virtualbox-iso-eos: Executing: export ztps-eos_20150120_023909 --output ztps-eos_20150120_023909-vbox/ztps-eos_20150120_023909.ovf
==> virtualbox-iso-eos: Unregistering and deleting virtual machine...
Build 'virtualbox-iso-eos' finished.

==> Builds finished. The artifacts of successful builds are:
--> virtualbox-iso-eos: VM files in directory: ztps-eos_20150120_023909-vbox
Return code:0
Path: Ubuntu/
VM: ztps-eos_20150120_023909-vbox/ztps-eos_20150120_023909.ovf
0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage: error: Appliance read failed
VBoxManage: error: Could not read OVF file 'ztps-eos_20150120_023909.ovf' (VERR_FILE_NOT_FOUND)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Appliance, interface IAppliance
VBoxManage: error: Context: "int handleImportAppliance(HandlerArg*)" at line 304 of file VBoxManageAppliance.cpp

After manually loading the VM into VirtualBox manually though, everything seems to be ok.

Could this be another permissions issue?

advornic commented 9 years ago

Aah, looks like the path is the problem (the name of the folder representing the OS is missing):

# ls -l ztps-eos_20150120_023909-vbox/ztps-eos_20150120_023909.ovf
ls: ztps-eos_20150120_023909-vbox/ztps-eos_20150120_023909.ovf: No such file or directory

# ls -l **Fedora**/ztps-eos_20150120_023909-vbox/ztps-eos_20150120_023909.ovf
-rw-------  1 advornic  staff  10722 Jan 20 03:07 Fedora/ztps-eos_20150120_023909-vbox/ztps-eos_20150120_023909.ovf

I suspect that if I ran this form within the Fedora folder, it would have succeeded. However, I think we should make this independent of that.

phil-dileo commented 9 years ago

This issue is with this piece of code I didn't update:

def registerVbox(hyper, libDir, vmName, vmOS):
    #Import the VM into Vbox
    if hyper == "virtualbox":
        cmd = "%s/vboxmanage" % libDir
        vmPath = "%s-vbox/%s.ovf" % (vmName, vmName)
        if vmOS == "fedora":
            path = "Fedora/"
        else:
            path = "Ubuntu/"

        print "Path: %s" % path
        print "VM: %s" % vmPath

        subprocess.call([ cmd, "import", vmPath ], cwd=path)

Adding this line should do it:

  if (vmOS == "fedora" or vmOS == "eos"):