def status_machine(self):
""" Get status of virtual machine.
"""
try:
status = subprocess.check_output(["docker-machine", "status",
self.name],
stderr=subprocess.DEVNULL).decode().rstrip()
if status.lower() == "running":
return VmState.RUNNING
elif status.lower() == "stopped":
return VmState.STOPPED
else:
return VmState.UNKNOWN
except:
return VmState.NOEXIST
# private methods
评论列表
文章目录