From 9c2ff2f862d4881ddb1c3db8abc4946d0a0f1383 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 29 May 2019 12:14:53 -0700 Subject: [PATCH] fix image prune logic --- CHANGES | 1 + src/platform.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 4d6f40ddb..37c5eb490 100644 --- a/CHANGES +++ b/CHANGES @@ -1613,4 +1613,5 @@ [4.1.1] * Add UI hint about SFTP access restriction * Accept incoming mail from a private relay +* Fix issue where unused addon images were not pruned diff --git a/src/platform.js b/src/platform.js index 435673e03..0383ed8f7 100644 --- a/src/platform.js +++ b/src/platform.js @@ -119,10 +119,13 @@ function pruneInfraImages(callback) { if (!line) continue; let parts = line.split(' '); // [ ID, Repo:Tag@Digest ] if (image.tag === parts[1]) continue; // keep - debug(`pruneInfraImages: removing unused image of ${image.repo}: ${line}`); + debug(`pruneInfraImages: removing unused image of ${image.repo}: tag: ${parts[1]} id: ${parts[0]}`); - shell.exec('pruneInfraImages', `docker rmi ${parts[0]}`, iteratorCallback); + let result = safe.child_process.execSync(`docker rmi ${parts[0]}`, { encoding: 'utf8' }); + if (result === null) debug(`Erroring removing image ${parts[0]}: ${safe.error.mesage}`); } + + iteratorCallback(); }, callback); }