diff options
author | Joffrey F <joffrey@docker.com> | 2016-09-30 17:46:58 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2016-11-04 15:10:12 -0700 |
commit | 3ac73a285b2f370f6aa300d8a55c5af55660d0f4 (patch) | |
tree | 21427e4a0b7f2bff19a816027bca1f7e4c986a72 | |
parent | be2ae8df36271cd49cde308d1bb86609624d3b2c (diff) | |
download | docker-py-1212-fix_create_service.tar.gz |
Fix endpoint spec and networks params in update_service1212-fix_create_service
Signed-off-by: Joffrey F <joffrey@docker.com>
-rw-r--r-- | docker/api/service.py | 17 | ||||
-rw-r--r-- | 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. |