Kaydet (Commit) dac943a9 authored tarafından Aron Parsons's avatar Aron Parsons Kaydeden (comit) Joffrey F

honor placement preferences via services.create()

this allows creating a service with placement preferences when
calling services.create().  only constraints were being honored
before.

related to https://github.com/docker/docker-py/pull/1615Signed-off-by: 's avatarAron Parsons <aron@knackworks.com>
üst 29dee5ac
......@@ -321,10 +321,15 @@ def _get_create_service_kwargs(func_name, kwargs):
if 'container_labels' in kwargs:
container_spec_kwargs['labels'] = kwargs.pop('container_labels')
placement = {}
if 'constraints' in kwargs:
task_template_kwargs['placement'] = {
'Constraints': kwargs.pop('constraints')
}
placement['Constraints'] = kwargs.pop('constraints')
if 'preferences' in kwargs:
placement['Preferences'] = kwargs.pop('preferences')
task_template_kwargs['placement'] = placement
if 'log_driver' in kwargs:
task_template_kwargs['log_driver'] = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment