Skip to content

Commit

Permalink
Use the system's docker daemon if no data dir is set nor docker_daemo…
Browse files Browse the repository at this point in the history
…n_private

So no configuration in the DEFAULT section is needed for the simplest case.
  • Loading branch information
cvaroqui committed Feb 20, 2018
1 parent 1c9df2a commit ba9807a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
17 changes: 10 additions & 7 deletions lib/rcDocker.py
Expand Up @@ -27,11 +27,20 @@ def __init__(self, svc=None):
self.max_wait_for_dockerd = 5
self.docker_info_done = False

try:
self.docker_data_dir = \
self.svc.conf_get('DEFAULT', 'docker_data_dir')
except ex.OptNotFound as exc:
self.docker_data_dir = exc.default

try:
self.docker_daemon_private = \
self.svc.conf_get('DEFAULT', 'docker_daemon_private')
except ex.OptNotFound:
self.docker_daemon_private = True
if self.docker_data_dir:
self.docker_daemon_private = True
else:
self.docker_daemon_private = False
if rcEnv.sysname != "Linux":
self.docker_daemon_private = False

Expand All @@ -47,12 +56,6 @@ def __init__(self, svc=None):
except ex.OptNotFound as exc:
self.dockerd_exe_init = exc.default

try:
self.docker_data_dir = \
self.svc.conf_get('DEFAULT', 'docker_data_dir')
except ex.OptNotFound as exc:
self.docker_data_dir = exc.default

try:
self.docker_daemon_args = \
self.svc.conf_get('DEFAULT', 'docker_daemon_args')
Expand Down
2 changes: 1 addition & 1 deletion lib/svcdict.py
Expand Up @@ -245,7 +245,7 @@ def __init__(self):
keyword="docker_data_dir",
at=True,
order=12,
text="If the service has docker-type container resources and docker_daemon_private is set to True, the service handles the startup of a private docker daemon. Its socket is <pathvar>/services/<svcname>/docker.sock, and its data directory must be specified using this parameter. This organization is necessary to enable service relocalization.",
text="If the service has docker-type container resources and this keyword is set, the service starts a service-private docker daemon. Its socket is <pathvar>/services/<svcname>/docker.sock, and its data directory is specified by this keyword. This organization is necessary to enable stateful service relocalization.",
example="/srv/svc1/data/docker"
)

Expand Down
11 changes: 5 additions & 6 deletions usr/share/doc/template.service.DEFAULT.conf
Expand Up @@ -249,12 +249,11 @@
# inheritance: leaf > head
# scope order: specific > generic
#
# desc: If the service has docker-type container resources and
# docker_daemon_private is set to True, the service handles the
# startup of a private docker daemon. Its socket is
# <pathvar>/services/<svcname>/docker.sock, and its data directory
# must be specified using this parameter. This organization is
# necessary to enable service relocalization.
# desc: If the service has docker-type container resources and this keyword
# is set, the service starts a service-private docker daemon. Its
# socket is <pathvar>/services/<svcname>/docker.sock, and its data
# directory is specified by this keyword. This organization is
# necessary to enable stateful service relocalization.
#
;docker_data_dir = /srv/svc1/data/docker

Expand Down

0 comments on commit ba9807a

Please sign in to comment.