[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,18 +897,20 @@ 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', [])
|
||||
ds.update_delay = update_config_data['Delay']
|
||||
ds.update_parallelism = update_config_data['Parallelism']
|
||||
ds.update_failure_action = update_config_data['FailureAction']
|
||||
ds.update_monitor = update_config_data['Monitor']
|
||||
ds.update_max_failure_ratio = update_config_data['MaxFailureRatio']
|
||||
ds.update_order = update_config_data['Order']
|
||||
|
||||
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']
|
||||
ds.update_monitor = update_config_data['Monitor']
|
||||
ds.update_max_failure_ratio = update_config_data['MaxFailureRatio']
|
||||
ds.update_order = update_config_data['Order']
|
||||
|
||||
dns_config = task_template_data['ContainerSpec'].get('DNSConfig', None)
|
||||
if dns_config:
|
||||
|
|
Loading…
Reference in a new issue