From 3ac73a285b2f370f6aa300d8a55c5af55660d0f4 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Fri, 30 Sep 2016 17:46:58 -0700 Subject: Fix endpoint spec and networks params in update_service Signed-off-by: Joffrey F --- docker/api/service.py | 17 +++++++++++++---- docs/services.md | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docker/api/service.py b/docker/api/service.py index 39a23e4..2e41b7c 100644 --- a/docker/api/service.py +++ b/docker/api/service.py @@ -83,7 +83,16 @@ class ServiceApiMixin(object): @utils.check_resource def update_service(self, service, version, task_template=None, name=None, labels=None, mode=None, update_config=None, - networks=None, endpoint_config=None): + networks=None, endpoint_config=None, + endpoint_spec=None): + + if endpoint_config is not None: + warnings.warn( + 'endpoint_config has been renamed to endpoint_spec.', + DeprecationWarning + ) + endpoint_spec = endpoint_config + url = self._url('/services/{0}/update', service) data = {} headers = {} @@ -104,9 +113,9 @@ class ServiceApiMixin(object): if update_config is not None: data['UpdateConfig'] = update_config if networks is not None: - data['Networks'] = networks - if endpoint_config is not None: - data['Endpoint'] = endpoint_config + data['Networks'] = utils.convert_service_networks(networks) + if endpoint_spec is not None: + data['EndpointSpec'] = endpoint_spec resp = self._post_json( url, data=data, params={'version': version}, headers=headers diff --git a/docs/services.md b/docs/services.md index 3935205..69e0649 100644 --- a/docs/services.md +++ b/docs/services.md @@ -137,7 +137,7 @@ Update a service. See the [UpdateConfig class](#UpdateConfig) for details. Default: `None`. * networks (list): List of network names or IDs to attach the service to. Default: `None`. -* endpoint_config (dict): Properties that can be configured to access and load +* endpoint_spec (dict): Properties that can be configured to access and load balance a service. Default: `None`. **Returns:** `True` if successful. Raises an `APIError` otherwise. -- cgit v1.2.1