Merge pull request #936 from ansible/docker-pid-mode
Make pid_mode parameter do minimum docker-py/docker server version checks
This commit is contained in:
commit
e4a5b46cfb
1 changed files with 8 additions and 3 deletions
|
@ -223,7 +223,7 @@ options:
|
||||||
version_added: "1.8"
|
version_added: "1.8"
|
||||||
pid:
|
pid:
|
||||||
description:
|
description:
|
||||||
- Set the PID namespace mode for the container (currently only supports 'host'). Requires docker-py >= 1.0.0 and docker >= 1.4.1.
|
- Set the PID namespace mode for the container (currently only supports 'host'). Requires docker-py >= 1.0.0 and docker >= 1.5.0
|
||||||
required: false
|
required: false
|
||||||
default: None
|
default: None
|
||||||
aliases: []
|
aliases: []
|
||||||
|
@ -486,6 +486,7 @@ class DockerManager(object):
|
||||||
'dns': ((0, 3, 0), '1.10'),
|
'dns': ((0, 3, 0), '1.10'),
|
||||||
'volumes_from': ((0, 3, 0), '1.10'),
|
'volumes_from': ((0, 3, 0), '1.10'),
|
||||||
'restart_policy': ((0, 5, 0), '1.14'),
|
'restart_policy': ((0, 5, 0), '1.14'),
|
||||||
|
'pid': ((1, 0, 0), '1.17'),
|
||||||
# Clientside only
|
# Clientside only
|
||||||
'insecure_registry': ((0, 5, 0), '0.0')
|
'insecure_registry': ((0, 5, 0), '0.0')
|
||||||
}
|
}
|
||||||
|
@ -1221,11 +1222,11 @@ class DockerManager(object):
|
||||||
'privileged': self.module.params.get('privileged'),
|
'privileged': self.module.params.get('privileged'),
|
||||||
'links': self.links,
|
'links': self.links,
|
||||||
'network_mode': self.module.params.get('net'),
|
'network_mode': self.module.params.get('net'),
|
||||||
'pid_mode': self.module.params.get('pid'),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
optionals = {}
|
optionals = {}
|
||||||
for optional_param in ('dns', 'volumes_from', 'restart_policy', 'restart_policy_retry'):
|
for optional_param in ('dns', 'volumes_from', 'restart_policy',
|
||||||
|
'restart_policy_retry', 'pid'):
|
||||||
optionals[optional_param] = self.module.params.get(optional_param)
|
optionals[optional_param] = self.module.params.get(optional_param)
|
||||||
|
|
||||||
if optionals['dns'] is not None:
|
if optionals['dns'] is not None:
|
||||||
|
@ -1242,6 +1243,10 @@ class DockerManager(object):
|
||||||
if params['restart_policy']['Name'] == 'on-failure':
|
if params['restart_policy']['Name'] == 'on-failure':
|
||||||
params['restart_policy']['MaximumRetryCount'] = optionals['restart_policy_retry']
|
params['restart_policy']['MaximumRetryCount'] = optionals['restart_policy_retry']
|
||||||
|
|
||||||
|
if optionals['pid'] is not None:
|
||||||
|
self.ensure_capability('pid')
|
||||||
|
params['pid_mode'] = optionals['pid']
|
||||||
|
|
||||||
for i in containers:
|
for i in containers:
|
||||||
self.client.start(i['Id'], **params)
|
self.client.start(i['Id'], **params)
|
||||||
self.increment_counter('started')
|
self.increment_counter('started')
|
||||||
|
|
Loading…
Reference in a new issue