pycontribs / python-vagrant

Python bindings for interacting with Vagrant virtual machines.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vagrant 1.8 support

conorsch opened this issue · comments

Vagrant 1.8 changed the output returned by vagrant status --machine-readable, which causes dummy boxes to be returned by the v.status() call.

Output from vagrant status --machine-readable with 1.7.4:

1450806320,server,provider-name,virtualbox
1450806320,server,state,running
1450806320,server,state-human-short,running
1450806320,server,state-human-long,The VM is running. To stop this VM%!(VAGRANT_COMMA) you can run `vagrant halt` to\nshut it down forcefully%!(VAGRANT_COMMA) or you can run `vagrant suspend` to simply\nsuspend the virtual machine. In either case%!(VAGRANT_COMMA) to restart it again%!(VAGRANT_COMMA)\nsimply run `vagrant up`.
1450806321,client,provider-name,virtualbox
1450806321,client,state,running
1450806321,client,state-human-short,running
1450806321,client,state-human-long,The VM is running. To stop this VM%!(VAGRANT_COMMA) you can run `vagrant halt` to\nshut it down forcefully%!(VAGRANT_COMMA) or you can run `vagrant suspend` to simply\nsuspend the virtual machine. In either case%!(VAGRANT_COMMA) to restart it again%!(VAGRANT_COMMA)\nsimply run `vagrant up`.

Output from vagrant status --machine-readable with 1.8.0:

1450813573,server,metadata,provider,virtualbox
1450813574,client,metadata,provider,virtualbox
1450813574,server,provider-name,virtualbox
1450813574,server,state,running
1450813574,server,state-human-short,running
1450813574,server,state-human-long,The VM is running. To stop this VM%!(VAGRANT_COMMA) you can run `vagrant halt` to\nshut it down forcefully%!(VAGRANT_COMMA) or you can run `vagrant suspend` to simply\nsuspend the virtual machine. In either case%!(VAGRANT_COMMA) to restart it again%!(VAGRANT_COMMA)\nsimply run `vagrant up`.
1450813574,client,provider-name,virtualbox
1450813574,client,state,running
1450813574,client,state-human-short,running
1450813574,client,state-human-long,The VM is running. To stop this VM%!(VAGRANT_COMMA) you can run `vagrant halt` to\nshut it down forcefully%!(VAGRANT_COMMA) or you can run `vagrant suspend` to simply\nsuspend the virtual machine. In either case%!(VAGRANT_COMMA) to restart it again%!(VAGRANT_COMMA)\nsimply run `vagrant up`.
1450813574,,ui,info,Current machine states:\n\nserver                    running (virtualbox)\nclient                    running (virtualbox)\n\nThis environment represents multiple VMs. The VMs are all listed\nabove with their current state. For more information about a specific\nVM%!(VAGRANT_COMMA) run `vagrant status NAME`.

Specifically, it's these lines that are new:

1450813573,server,metadata,provider,virtualbox
1450813574,client,metadata,provider,virtualbox
1450813574,,ui,info,Current machine states:\n\nserver                    running (virtualbox)\nclient                    running (virtualbox)\n\nThis environment represents multiple VMs. The VMs are all listed\nabove with their current state. For more information about a specific\nVM%!(VAGRANT_COMMA) run `vagrant status NAME`.

And here's an example of the duplicate VM entries returned by v.status() running under 1.8.4:

[Status(name='server', state=None, provider=None),
 Status(name='client', state=None, provider=None),
 Status(name='server', state='running', provider='virtualbox'),
 Status(name='client', state='running', provider='virtualbox'),
 Status(name='', state=None, provider=None)]

I'll start digging around in the parsing functions, but the larger issue is implementing version-aware support.