Skip to content

Conversation

@snare
Copy link
Contributor

@snare snare commented Jul 2, 2015

Added a Fusion class which is a bit more user-friendly than just calling vmrun. You can give it a directory to find more VMs since vmrun doesn't return any VMs that are not currently running. It has a collection of VM objects which can be accessed by index or name.

    >>> import vmfusion
    >>> f = vmfusion.Fusion('/Users/x/VM')
    >>> [v.name for v in f.vms]
    ['QNX', 'Ubuntu 64-bit', 'Windows 7 x64']
    >>> [v.is_running for v in f.vms]
    [False, False, False]
    >>> f[0]
    <vmfusion.VM object at 0x10a018910>
    >>> f[0].name
    'QNX'
    >>> f['QNX']
    <vmfusion.VM object at 0x10a018910>
    >>> f['QNX'].name
    'QNX'
    >>> f[-1].start()
    >>> [v.is_running for v in f.vms]
    [False, False, True]

I also added an is_running property to the VM class.

It looks like my text editor trimmed a bunch of trailing whitespace here and there too.

@msteinhoff
Copy link
Owner

Hm, this is basically the same as https://github.com/msteinhoff/vmfusion-cli/blob/master/bin/vmfusion-cli.

There are also a bunch of other changes in the pipeline (a reworked and more flexible API and an editorconfig to get rid of the whitesapce problems) but I am currently busy with contracting work and a few weeks of holiday starting next week.

I try to check back with this end of August.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants