hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.05k stars 3.32k forks source link

digitalocean-import does not accept .ova or .ovf files #7848

Open jcrben opened 5 years ago

jcrben commented 5 years ago

When I tried this post-processor, I got the following message:

Build 'digitalocean-importer' errored: 1 error(s) occurred:

* Post-processor failed: Import of image bencreasycom failed with error: We don't support the compression format of your image. Please try again with a supported format (gzip, bzip2) or an uncompressed image file.

The .ova includes vmdk https://blog.digitalocean.com/custom-images/ so it seems like it should be able to pull that out?

I opened a ticket with DigitalOcean and they said this:

Thank you for contacting us! I’ll be happy to help you get started with Custom Images.

You can navigate to “Import Images” on the Cloud control panel to upload your image. As of launch, we only support uploads directly on the control panel, in the next few months we will open access to upload images via the API.

You can upload any Unix-like OS that supports ext3/4 file systems and has cloudinit 0.7.5, cloudbase-init, coreos-cloudinit, ignition or bsd-cloudinit installed.

Best Regards,
 Purnima Kumari
 Platform Support Specialist
 DigitalOcean

Note that I did not install cloudinit on this machine (yet) as I was just messing around.

jcrben commented 5 years ago

@andrewsomething wonder if you might have a tip since I noticed you added it https://github.com/hashicorp/packer/pull/7060

andrewsomething commented 5 years ago

Hi @jcrben. Unfortunately it looks like this is a DigitalOcean limitation. It is not a restriction on the Packer side. The Packer code in question only looks at the file suffix if the builder returns multiple artifacts.

This error is returned via the DigitalOcean API. For example, using curl directly to import a .ova file:

$ curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $DO_TOKEN" -d '{"name": "Ubuntu_for_Horizon71_1_1.0.ova", "url": "https://download3.vmware.com/software/vmw-tools/horizon_ubuntu/Ubuntu_for_Horizon71_1_1.0.ova", "distribution": "Ubuntu", "region": "nyc3", "description": "VMware Horizon 7.1 environment"}' "https://api.digitalocean.com/v2/images" | jq .
{
  "image": {
    "created_at": "2019-07-06T23:48:11Z",
    "description": "VMware Horizon 7.1 environment",
    "distribution": "Ubuntu",
    "error_message": "",
    "id": 49292794,
    "name": "Ubuntu_for_Horizon71_1_1.0.ova",
    "regions": [],
    "status": "NEW",
    "tags": [],
    "type": "custom",
    "updated_at": "2019-07-06T23:48:11Z"
  }
}

# After waiting sometime for the image to be processed on DO's end...

$ curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $DO_TOKEN" "https://api.digitalocean.com/v2/images/49292794" | jq .
{
  "image": {
    "id": 49292794,
    "name": "Ubuntu_for_Horizon71_1_1.0.ova",
    "distribution": "Ubuntu",
    "slug": null,
    "public": false,
    "regions": [],
    "created_at": "2019-07-06T23:48:11Z",
    "min_disk_size": null,
    "type": "custom",
    "size_gigabytes": null,
    "description": "VMware Horizon 7.1 environment",
    "tags": [],
    "status": "deleted",
    "error_message": "We don't support the compression format of your image. Please try again with a supported format (gzip, bzip2) or an uncompressed image file."
  }
}

I'll pass this along internally at DO as it sounds like support didn't completely understand the issue at hand.

jcrben commented 5 years ago

Looks like you work at DO so you could get them to accept .ova on their side, but if not it seems like we could adjust the post-processor to unpack the ova and send up the vmdk inside?

SwampDragons commented 5 years ago

You could already do this with the shell-local pp and the artifice pp, probably.

jcrben commented 4 years ago

@andrewsomething hear anything about this?