Skip to content

Commit 947c47f

Browse files
committed
Move ExecResult definition to models.containers
Signed-off-by: Joffrey F <[email protected]>
1 parent 600cc15 commit 947c47f

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

docker/models/containers.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import copy
2+
from collections import namedtuple
23

34
from ..api import APIClient
45
from ..errors import (ContainerError, ImageNotFound,
56
create_unexpected_kwargs_error)
6-
from ..types import ExecResult, HostConfig
7+
from ..types import HostConfig
78
from ..utils import version_gte
89
from .images import Image
910
from .resource import Collection, Model
@@ -173,10 +174,11 @@ def exec_run(self, cmd, stdout=True, stderr=True, stdin=False, tty=False,
173174
)
174175
if socket or stream:
175176
return ExecResult(None, exec_output)
176-
else:
177-
return ExecResult(
178-
self.client.api.exec_inspect(resp['Id'])['ExitCode'],
179-
exec_output)
177+
178+
return ExecResult(
179+
self.client.api.exec_inspect(resp['Id'])['ExitCode'],
180+
exec_output
181+
)
180182

181183
def export(self):
182184
"""
@@ -1007,3 +1009,8 @@ def _host_volume_from_bind(bind):
10071009
return bits[0]
10081010
else:
10091011
return bits[1]
1012+
1013+
1014+
ExecResult = namedtuple('ExecResult', 'exit_code,output')
1015+
""" A result of Container.exec_run with the properties ``exit_code`` and
1016+
``output``. """

docker/types/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# flake8: noqa
2-
from .containers import (ContainerConfig, ExecResult, HostConfig, LogConfig,
3-
Ulimit)
2+
from .containers import ContainerConfig, HostConfig, LogConfig, Ulimit
43
from .healthcheck import Healthcheck
54
from .networks import EndpointConfig, IPAMConfig, IPAMPool, NetworkingConfig
65
from .services import (

docker/types/containers.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from collections import namedtuple
21
import six
32
import warnings
43

@@ -12,11 +11,6 @@
1211
from .healthcheck import Healthcheck
1312

1413

15-
ExecResult = namedtuple('ExecResult', 'exit_code,output')
16-
""" A result of Container.exec_run with the properties ``exit_code`` and
17-
``output``. """
18-
19-
2014
class LogConfigTypesEnum(object):
2115
_values = (
2216
'json-file',

0 commit comments

Comments
 (0)