New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize Vagrant before importing the image disk #1247

Closed
willdurand opened this Issue Dec 6, 2012 · 6 comments

Comments

Projects
None yet
2 participants
@willdurand
Contributor

willdurand commented Dec 6, 2012

Heya,

Vagrant allows to customize the VirtualBox VM by using the config.vm.customize key in the Vagrantfile. Under the hood, this uses vboxmanage and you can find more information here: config.vm.customize.

Thing is, vboxmanage can also manage "global" properties, like the defaultMachineFolder:

vboxmanage setproperty machinefolder "/path/to/your/VirtualBox VMs/"

It's not possible to use Vagrant to run this command as customizations are executed after the image disk importation.

So my question is, could it be possible to run customizations before everything else? I guess it's not supported yet (or I missed something), so could it be an improvement?

Thanks,
William

@mitchellh

This comment has been minimized.

Show comment
Hide comment
@mitchellh

mitchellh Dec 21, 2012

Member

William,

This sounds fine to me. This isn't something I'd put back in 1.0.x but moving forward could be an option. My question: Are there any customizations that need to be run AFTER importing the disk? I'm afraid moving this would break some things.

Mitchell

Member

mitchellh commented Dec 21, 2012

William,

This sounds fine to me. This isn't something I'd put back in 1.0.x but moving forward could be an option. My question: Are there any customizations that need to be run AFTER importing the disk? I'm afraid moving this would break some things.

Mitchell

@willdurand

This comment has been minimized.

Show comment
Hide comment
@willdurand

willdurand Dec 22, 2012

Contributor

Are there any customizations that need to be run AFTER importing the disk?

According to the VBoxManage documentation, "most of [the VBoxManage] subcommands require that you specify a particular virtual machine after the subcommand.". IMO we should not change the existing process. Tweaking the VM should be done once the disk is imported.

VBoxManage subcommands that don't need a UUID:

  • list
  • registervm
  • createvm
  • import
  • export
  • createhd
  • setproperty
  • metrics
  • dhcpserver
  • extpack

To be more generic (as VirtualBox isn't the only thing we should consider now), I think we should find a name for these tasks that need to be performed before importing the disk, maybe like a hook: config.vm.pre_import.

What do you think?

Contributor

willdurand commented Dec 22, 2012

Are there any customizations that need to be run AFTER importing the disk?

According to the VBoxManage documentation, "most of [the VBoxManage] subcommands require that you specify a particular virtual machine after the subcommand.". IMO we should not change the existing process. Tweaking the VM should be done once the disk is imported.

VBoxManage subcommands that don't need a UUID:

  • list
  • registervm
  • createvm
  • import
  • export
  • createhd
  • setproperty
  • metrics
  • dhcpserver
  • extpack

To be more generic (as VirtualBox isn't the only thing we should consider now), I think we should find a name for these tasks that need to be performed before importing the disk, maybe like a hook: config.vm.pre_import.

What do you think?

@mitchellh

This comment has been minimized.

Show comment
Hide comment
@mitchellh

mitchellh Jan 31, 2013

Member

I like this idea. I'm just trying to think of terminology to use but I think I can get this in before 1.1.

Member

mitchellh commented Jan 31, 2013

I like this idea. I'm just trying to think of terminology to use but I think I can get this in before 1.1.

@willdurand

This comment has been minimized.

Show comment
Hide comment
@willdurand

willdurand Jan 31, 2013

Contributor

Would it be possible to have config.vm.customize.pre_import? That would
leave the door open to further hooks, without breaking BC (hopefully).

William Durand | http://www.williamdurand.fr

On Thu, Jan 31, 2013 at 7:05 AM, Mitchell Hashimoto <
notifications@github.com> wrote:

I like this idea. I'm just trying to think of terminology to use but I
think I can get this in before 1.1.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1247#issuecomment-12929128.

Contributor

willdurand commented Jan 31, 2013

Would it be possible to have config.vm.customize.pre_import? That would
leave the door open to further hooks, without breaking BC (hopefully).

William Durand | http://www.williamdurand.fr

On Thu, Jan 31, 2013 at 7:05 AM, Mitchell Hashimoto <
notifications@github.com> wrote:

I like this idea. I'm just trying to think of terminology to use but I
think I can get this in before 1.1.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1247#issuecomment-12929128.

@mitchellh

This comment has been minimized.

Show comment
Hide comment
@mitchellh

mitchellh Jul 23, 2013

Member

Finally this feature is done. The old syntax doesn't change. But you can now do this:

v.customize "pre-boot", ["command", "to", "run"]
Member

mitchellh commented Jul 23, 2013

Finally this feature is done. The old syntax doesn't change. But you can now do this:

v.customize "pre-boot", ["command", "to", "run"]

@mitchellh mitchellh closed this Jul 23, 2013

@willdurand

This comment has been minimized.

Show comment
Hide comment
@willdurand

willdurand Jul 23, 2013

Contributor

\o/ thanks! 🎆 🌟

Contributor

willdurand commented Jul 23, 2013

\o/ thanks! 🎆 🌟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment