Fix endpoint spec and networks params in update_service

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2016-09-30 17:46:58 -07:00
parent be2ae8df36
commit 3ac73a285b
2 changed files with 14 additions and 5 deletions

View File

@ -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

View File

@ -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.