[2.7] docker_swarm_service: fix problem with UpdateConfig on certain docker daemons (#53224)
* Avoid KeyError when UpdateConfig isn't returned. * Add changelog.
This commit is contained in:
parent
597db1dc28
commit
122e73d062
2 changed files with 11 additions and 7 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "docker_swarm_service - fix problem with docker daemons which do not return ``UpdateConfig`` in the swarm service spec."
|
|
@ -897,12 +897,14 @@ class DockerServiceManager():
|
|||
ds = DockerService()
|
||||
|
||||
task_template_data = raw_data['Spec']['TaskTemplate']
|
||||
update_config_data = raw_data['Spec']['UpdateConfig']
|
||||
|
||||
ds.image = task_template_data['ContainerSpec']['Image']
|
||||
ds.user = task_template_data['ContainerSpec'].get('User', 'root')
|
||||
ds.env = task_template_data['ContainerSpec'].get('Env', [])
|
||||
ds.args = task_template_data['ContainerSpec'].get('Args', [])
|
||||
|
||||
update_config_data = raw_data['Spec'].get('UpdateConfig')
|
||||
if update_config_data:
|
||||
ds.update_delay = update_config_data['Delay']
|
||||
ds.update_parallelism = update_config_data['Parallelism']
|
||||
ds.update_failure_action = update_config_data['FailureAction']
|
||||
|
|
Loading…
Reference in a new issue