Skip to content

Missed rollback_config in service's create/update methods. #2832

Closed

Description

Hi, in documentation for service written that it support rollback_config parameter, but in models/services.py's CREATE_SERVICE_KWARGS list doesn't contain it.
So, I got this error:
TypeError: create() got an unexpected keyword argument 'rollback_config'
Can someone tell me, is this done intentionally, or is it a bug?

Version: 4.4.4, 5.0.0 and older

My diff:

diff --git a/docker/models/services.py b/docker/models/services.py
index a29ff13..0f26626 100644
--- a/docker/models/services.py
+++ b/docker/models/services.py
@@ -314,6 +314,7 @@ CREATE_SERVICE_KWARGS = [
     'labels',
     'mode',
     'update_config',
+    'rollback_config',
     'endpoint_spec',
 ]

PS. Full stacktrace:

In [54]: service_our = client.services.create(
    ...:     name=service_name,
    ...:     image=image_full_name,
    ...:     restart_policy=restart_policy,
    ...:     update_config=update_config,
    ...:     rollback_config=rollback_config
    ...:     )
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-54-8cc6a8a6519b> in <module>
----> 1 service_our = client.services.create(
      2     name=service_name,
      3     image=image_full_name,
      4     restart_policy=restart_policy,
      5     update_config=update_config,

/usr/local/lib/python3.9/site-packages/docker/models/services.py in create(self, image, command, **kwargs)
    224         kwargs['image'] = image
    225         kwargs['command'] = command
--> 226         create_kwargs = _get_create_service_kwargs('create', kwargs)
    227         service_id = self.client.api.create_service(**create_kwargs)
    228         return self.get(service_id)

/usr/local/lib/python3.9/site-packages/docker/models/services.py in _get_create_service_kwargs(func_name, kwargs)
    369     # All kwargs should have been consumed by this point, so raise
    370     # error if any are left
--> 371     if kwargs:
    372         raise create_unexpected_kwargs_error(func_name, kwargs)
    373

TypeError: create() got an unexpected keyword argument 'rollback_config'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions