backup fails: KeyError: 'com.docker.swarm.service.name' #52

Closed
opened 2024-06-14 14:05:38 +00:00 by iexos · 5 comments
Owner

Just tried out a fresh deployment using current main. Result:

$ abra app run <app_name> app -- backup create
Uncaught exception
Traceback (most recent call last):
  File "/usr/bin/backup", line 372, in <module>
    cli()
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/backup", line 100, in create
    pre_commands, post_commands, backup_paths, apps = get_backup_cmds()
                                                      ^^^^^^^^^^^^^^^^^
  File "/usr/bin/backup", line 110, in get_backup_cmds
    container_by_service = {
                           ^
  File "/usr/bin/backup", line 111, in <dictcomp>
    c.labels['com.docker.swarm.service.name']: c for c in client.containers.list()}
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'com.docker.swarm.service.name'
Just tried out a fresh deployment using current `main`. Result: ``` $ abra app run <app_name> app -- backup create Uncaught exception Traceback (most recent call last): File "/usr/bin/backup", line 372, in <module> cli() File "/usr/lib/python3.11/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/bin/backup", line 100, in create pre_commands, post_commands, backup_paths, apps = get_backup_cmds() ^^^^^^^^^^^^^^^^^ File "/usr/bin/backup", line 110, in get_backup_cmds container_by_service = { ^ File "/usr/bin/backup", line 111, in <dictcomp> c.labels['com.docker.swarm.service.name']: c for c in client.containers.list()} ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'com.docker.swarm.service.name' ```
Owner

There was a wave of updates from Docker internals in the last while, maybe they changed this default label? @iexos would you be able to run a docker service inspect on the container you want to back up so we can see what labels are available?

There was a wave of updates from Docker internals in the last while, maybe they changed this default label? @iexos would you be able to run a `docker service inspect` on the container you want to back up so we can see what labels are available?
Owner

Do you run any docker services not deployed with abra?

Do you run any docker services not deployed with abra?
Author
Owner

Do you run any docker services not deployed with abra?

Yep thats it, there is a container running not deployed with swarm which thus does not have swarm labels. Would be fine for me to just skip non-swarm containers.

> Do you run any docker services not deployed with abra? Yep thats it, there is a container running not deployed with swarm which thus does not have swarm labels. Would be fine for me to just skip non-swarm containers.
Owner

This should be fixed now, can you test it?

This should be fixed now, can you test it?
Author
Owner

Its fixed, thank you! :)

Its fixed, thank you! :)
iexos closed this issue 2024-07-05 14:36:35 +00:00
Sign in to join this conversation.
No description provided.