def available_vms(self, vms=None):
"""
List all VMs regardless of state, filtering if requested via the <vms>
parameter provider by the CLI.
"""
try:
possible_vms = [vm for vm in self.v.status()]
except CalledProcessError, e:
# TODO: Exception handling here assumes Vagrantfile is missing.
# Vagrant seems to return 1 for many different errors, and finding
# documentation for specific return codes has proven difficult.
raise VagrantfileNotFound
if vms:
wanted_vms = [vm for vm in possible_vms if vm.name in vms]
possible_vms = wanted_vms
return possible_vms
评论列表
文章目录