Skip to content

Commit 463ebbb

Browse files
Fook MeFook Me
authored andcommitted
Fix Podman container ID lookup during Buzz retirement
1 parent cfe1d2a commit 463ebbb

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/shadowfetch-defaults/data/usr/libexec/shadowfetch-retire-buzz

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def retire_user(home, uid):
9090
retired = []
9191
for ident in sorted(ids):
9292
row = json.loads(checked(['podman', 'inspect', '--format',
93-
'[{{json .Id}},{{json .Name}},{{json .Config.Labels}}]', ident]))
93+
'[{{json .ID}},{{json .Name}},{{json .Config.Labels}}]', ident]))
9494
if not owned_container(row):
9595
continue
9696
# Do not remove containers, volumes, images, models, profiles or secrets.

packages/shadowfetch-defaults/tests/test_buzz_retirement.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def run(args):
5050
if args[3] == '{{.State.Running}}':
5151
out = 'false'
5252
else:
53+
# Podman exposes .ID, unlike the Docker-style .Id spelling.
54+
# The installed Podman rejects unknown template fields.
55+
if args[3] != '[{{json .ID}},{{json .Name}},{{json .Config.Labels}}]':
56+
return subprocess.CompletedProcess(args, 125, '', 'invalid inspect template')
5357
ident = args[-1]
5458
role = 'redis' if ident == 'a'*64 else 'unrelated'
5559
out = json.dumps([ident, f'shadowfetch-buzz_{role}_1', {

0 commit comments

Comments
 (0)