Skip to content

Commit 84a3ba8

Browse files
committed
Add 'running' operation on OpenVZ containers
1 parent d171c24 commit 84a3ba8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

fabtools/openvz/container.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def restart(self, **kwargs):
3939
def status(self):
4040
return vz.status(self.ctid)
4141

42+
def running(self):
43+
return vz.running(self.ctid)
44+
4245
def exists(self):
4346
return vz.exists(self.ctid)
4447

fabtools/openvz/operations.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ def status(ctid_or_name):
6262
return _vzctl('status', ctid_or_name)
6363

6464

65+
def running(ctid_or_name):
66+
"""
67+
Is the container running?
68+
"""
69+
return status(ctid_or_name).split(' ')[4] == 'running'
70+
71+
6572
def exists(ctid_or_name):
6673
"""
6774
Does the container exist?

0 commit comments

Comments
 (0)