jcftang / strider

Spins up dev/test VMs and bakes cloud images.
Apache License 2.0
17 stars 1 forks source link

Example for virtualbox? #3

Open bsanders opened 8 years ago

bsanders commented 8 years ago

I see there's some initial virtualbox support... is there any example for it?

jcftang commented 8 years ago

It looks like it may be a bit broken/non-functional, I had merged that in to keep track of contributions from various people.

To use it you do something like this....

#!/usr/bin/env python
# example strider file

from strider import Strider
from strider.virt.virtualbox import VBOX
from strider.provisioners.shell import Shell
import time
import os
from vboxapi import VirtualBoxManager

mgr = VirtualBoxManager("WEBSERVICE",
        {'url':'myIP', 'user':'myServerLogin', 'password':'myPassthere'}
        )

instance = VBOX(
        name = "%s-strider-test" % os.environ["USER"],
        virtualbox_manager = mgr,
        instance_type = "foo"
        )

provisioner = Shell(
        commands = [
            "echo command",
            ]
        )

pre_bake = Shell(
        commands = [
            "sync"
            ]
        )

post_bake = Shell(
        commands = [
            "echo 'post bake steps!'"
            ]

        )

strider = Strider(provisioner=provisioner, pre_bake=pre_bake, post_bake=post_bake).cli(instance)

However I'm not familar with the vboxapi, I don't what virtualbox_manager and instance_type type should be. It might be worth rewriting the virtualbox module with http://pythonhosted.org/pyvbox/ in mind