Changed docker_restart_policy to unless-stopped
Current implementation has docker_restart_policy "always" and docker_restart_policy_retry:"10" which should be mutually exclusive. "unless-stopped" will restart the containers on any exit state but not start on daemon startup if container was put to stopped state before. Closes-Bug: #1621187 Change-Id: I4d881cd123a55625121b7a9047385e9b54e2e129
This commit is contained in:
parent
b1511a1719
commit
3f134d0f53
@ -72,8 +72,8 @@ docker_registry:
|
||||
docker_namespace: "kolla"
|
||||
docker_registry_username:
|
||||
|
||||
# Valid options are [ never, on-failure, always ]
|
||||
docker_restart_policy: "always"
|
||||
# Valid options are [ never, on-failure, always, unless-stopped ]
|
||||
docker_restart_policy: "unless-stopped"
|
||||
|
||||
# '0' means unlimited retries
|
||||
docker_restart_policy_retry: "10"
|
||||
|
@ -145,6 +145,7 @@ options:
|
||||
- never
|
||||
- on-failure
|
||||
- always
|
||||
- unless-stopped
|
||||
restart_retries:
|
||||
description:
|
||||
- How many times to attempt a restart if restart_policy is set
|
||||
@ -511,7 +512,9 @@ class DockerWorker(object):
|
||||
'volumes_from': self.params.get('volumes_from')
|
||||
}
|
||||
|
||||
if self.params.get('restart_policy') in ['on-failure', 'always']:
|
||||
if self.params.get('restart_policy') in ['on-failure',
|
||||
'always',
|
||||
'unless-stopped']:
|
||||
options['restart_policy'] = {
|
||||
'Name': self.params.get('restart_policy'),
|
||||
'MaximumRetryCount': self.params.get('restart_retries')
|
||||
@ -674,10 +677,12 @@ def generate_module():
|
||||
pid_mode=dict(required=False, type='str', choices=['host']),
|
||||
privileged=dict(required=False, type='bool', default=False),
|
||||
remove_on_exit=dict(required=False, type='bool', default=True),
|
||||
restart_policy=dict(required=False, type='str', choices=['no',
|
||||
restart_policy=dict(required=False, type='str', choices=[
|
||||
'no',
|
||||
'never',
|
||||
'on-failure',
|
||||
'always']),
|
||||
'always',
|
||||
'unless-stopped']),
|
||||
restart_retries=dict(required=False, type='int', default=10),
|
||||
tls_verify=dict(required=False, type='bool', default=False),
|
||||
tls_cert=dict(required=False, type='str'),
|
||||
|
@ -73,7 +73,8 @@ class ModuleArgsTest(base.BaseTestCase):
|
||||
required=False, type='str', choices=['no',
|
||||
'never',
|
||||
'on-failure',
|
||||
'always']),
|
||||
'always',
|
||||
'unless-stopped']),
|
||||
restart_retries=dict(required=False, type='int', default=10),
|
||||
tls_verify=dict(required=False, type='bool', default=False),
|
||||
tls_cert=dict(required=False, type='str'),
|
||||
@ -107,7 +108,7 @@ FAKE_DATA = {
|
||||
'pid_mode': '',
|
||||
'privileged': False,
|
||||
'volumes_from': None,
|
||||
'restart_policy': 'always',
|
||||
'restart_policy': 'unless-stopped',
|
||||
'restart_retries': 10},
|
||||
'labels': {'build-date': '2016-06-02',
|
||||
'kolla_version': '2.0.1',
|
||||
|
Loading…
Reference in New Issue
Block a user