Skip to content

Commit 13b93eb

Browse files
committed
cmd-coreos-prune: Only add policy-cleanup when needed
We are adding empty policy-cleanup key:value for the build even when no pruning action in completed. Added changes to not do that anymore.
1 parent 5b8517c commit 13b93eb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cmd-coreos-prune

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,10 @@ def main():
190190
else:
191191
print(f"No container tags to prune for build {build_id}.")
192192
actions_completed.append(action) # Append action to completed list
193+
# Only add policy-cleanup for the build in builds.json if either of the action is completed
194+
if actions_completed:
195+
policy_cleanup = build.setdefault("policy-cleanup", {})
193196
# Update policy-cleanup for completed actions
194-
policy_cleanup = build.setdefault("policy-cleanup", {})
195197
for action in actions_completed:
196198
if action == "images":
197199
policy_cleanup["images-kept"] = images_to_keep

0 commit comments

Comments
 (0)