Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 583306c

Browse files
committed
add docker module
1 parent 6d93756 commit 583306c

File tree

5 files changed

+487
-0
lines changed

5 files changed

+487
-0
lines changed

test_docker/__init__.py

Whitespace-only changes.

test_docker/driver.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
class ContainerDriver(object):
2+
'''Base class for container drivers.'''
3+
4+
def create(self, context, container, sandbox_name=None):
5+
"""Create a container."""
6+
raise NotImplementedError()
7+
8+
def delete(self, container, force):
9+
"""Delete a container."""
10+
raise NotImplementedError()
11+
12+
def list(self):
13+
"""List all containers."""
14+
raise NotImplementedError()
15+
16+
def show(self, container):
17+
"""Show the details of a container."""
18+
raise NotImplementedError()
19+
20+
def reboot(self, container):
21+
"""Reboot a container."""
22+
raise NotImplementedError()
23+
24+
def stop(self, container):
25+
"""Stop a container."""
26+
raise NotImplementedError()
27+
28+
def start(self, container):
29+
"""Start a container."""
30+
raise NotImplementedError()
31+
32+
def pause(self, container):
33+
"""Pause a container."""
34+
raise NotImplementedError()
35+
36+
def unpause(self, container):
37+
"""Pause a container."""
38+
raise NotImplementedError()
39+
40+
def show_logs(self, container):
41+
"""Show logs of a container."""
42+
raise NotImplementedError()
43+
44+
def execute(self, container, command):
45+
"""Execute a command in a running container."""
46+
raise NotImplementedError()
47+
48+
def kill(self, container, signal):
49+
"""kill signal to a container."""
50+
raise NotImplementedError()
51+
52+
def create_sandbox(self, context, container, **kwargs):
53+
"""Create a sandbox."""
54+
raise NotImplementedError()
55+
56+
def delete_sandbox(self, context, sandbox_id):
57+
"""Delete a sandbox."""
58+
raise NotImplementedError()
59+
60+
# Note: This is not currently used, but
61+
# may be used later
62+
def stop_sandbox(self, context, sandbox_id):
63+
"""Stop a sandbox."""
64+
raise NotImplementedError()
65+
66+
def get_sandbox_id(self, container):
67+
"""Retrieve sandbox ID."""
68+
raise NotImplementedError()
69+
70+
def set_sandbox_id(self, container, sandbox_id):
71+
"""Set sandbox ID."""
72+
raise NotImplementedError()
73+
74+
def get_sandbox_name(self, container):
75+
"""Retrieve sandbox name."""
76+
raise NotImplementedError()
77+
78+
def get_container_name(self, container):
79+
"""Retrieve sandbox name."""
80+
raise NotImplementedError()
81+
82+
def get_addresses(self, context, container):
83+
"""Retrieve IP addresses of the container."""
84+
85+
def update(self, container):
86+
"""Update a container."""
87+
raise NotImplementedError()

test_docker/test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import test_docker
2+
3+
client = test_docker.DockerDriver()
4+
print 'container list'
5+
print client.list()

0 commit comments

Comments
 (0)