mirror of
https://github.com/docker/compose.git
synced 2025-07-13 16:54:25 +02:00
Merge pull request #4034 from realab/fix-restart-with-null-string
fix serialize restart spec with null string
This commit is contained in:
commit
50faddb683
@ -93,6 +93,8 @@ def parse_restart_spec(restart_config):
|
|||||||
|
|
||||||
|
|
||||||
def serialize_restart_spec(restart_spec):
|
def serialize_restart_spec(restart_spec):
|
||||||
|
if not restart_spec:
|
||||||
|
return ''
|
||||||
parts = [restart_spec['Name']]
|
parts = [restart_spec['Name']]
|
||||||
if restart_spec['MaximumRetryCount']:
|
if restart_spec['MaximumRetryCount']:
|
||||||
parts.append(six.text_type(restart_spec['MaximumRetryCount']))
|
parts.append(six.text_type(restart_spec['MaximumRetryCount']))
|
||||||
|
@ -236,6 +236,10 @@ class CLITestCase(DockerClientTestCase):
|
|||||||
'image': 'busybox',
|
'image': 'busybox',
|
||||||
'restart': 'on-failure:5',
|
'restart': 'on-failure:5',
|
||||||
},
|
},
|
||||||
|
'restart-null': {
|
||||||
|
'image': 'busybox',
|
||||||
|
'restart': ''
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'networks': {},
|
'networks': {},
|
||||||
'volumes': {},
|
'volumes': {},
|
||||||
|
3
tests/fixtures/restart/docker-compose.yml
vendored
3
tests/fixtures/restart/docker-compose.yml
vendored
@ -12,3 +12,6 @@ services:
|
|||||||
on-failure-5:
|
on-failure-5:
|
||||||
image: busybox
|
image: busybox
|
||||||
restart: "on-failure:5"
|
restart: "on-failure:5"
|
||||||
|
restart-null:
|
||||||
|
image: busybox
|
||||||
|
restart: ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user