Closed fatmcgav closed 9 years ago
Currently, it supports mutating locally available Cloud images. Haven't yet implemented downloading from VagrantCloud prior to mutate. Is this desired?
Hi Gavin,
Thanks for contributing this!
I'm wondering why you chose to implement get_version
the way you did. What do we gain by downloading the metadata file instead of looking on disk?
For example, given vagrant mutate hashicorp/precise64 libvirt
and this directory structure
$ find .vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/
.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/
.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.0.0
.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.0.0/virtualbox
.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.0.0/virtualbox/box.ovf
.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.0.0/virtualbox/box-disk1.vmdk
.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.0.0/virtualbox/metadata.json
.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.0.0/virtualbox/Vagrantfile
.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/metadata_url
I can tell that the version should be 1.0.0.
If there are multiple versions on disk and the user didn't specify the version to use, we could default to the latest.
I think your current implementation would fail because it would download the metadata, see that the latest version is 1.1.0, and try to convert that version even though the user only has 1.0.0 not 1.1.0.
Let's not worry about downloading from vagrant cloud now. I'm considering removing the existing download functionality to simplify the code.
@sciurus using the file structure looks workable.
By downloading the meta data, it does open the option of downloading the base box before mutating, but if that functionality is going to be removed, then that's fine too...
I'll see if I can rework the code to parse the directory structure...
Cheers Gav
@sciurus Just pushed a commit that uses the filesystem directories rather than downloading the metadata.
Should solve the version mis-match issue.
I wanted to let you know I haven't forgotten about this! I'll try to retest this weekend.
great, looking forward to this !
Thanks for the revision! Looks good to me and works in my (limited) testing.
@sciurus Cheers for getting this merged in... Any chance of a release? ;)
I've opened #69 about a release; hopefully soon.
I've released this.
Add's support for VagrantCloud images using the [username]/[boxname] format. Also add's support for box versions.
WIP Further testing required prior to merge upstream. Current tests pass though :) Fixes #51 and #52