summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-26 17:24:09 +0200
committerGitHub <noreply@github.com>2019-08-26 17:24:09 +0200
commit112a3cce5d6dd05c04e90a81abe3220d0b5c8eea (patch)
tree4c9d4a76bb229da7df21948e359fda2d32e6438b
parent67926d86b50973d6cb0d8e953583441c8cb2fecf (diff)
parented88a5fb64f330f85e609587ac5028b7915211d8 (diff)
downloadpodman-112a3cce5d6dd05c04e90a81abe3220d0b5c8eea.tar.gz
podman-112a3cce5d6dd05c04e90a81abe3220d0b5c8eea.tar.bz2
podman-112a3cce5d6dd05c04e90a81abe3220d0b5c8eea.zip
Merge pull request #3883 from baude/varlinkbuildcleanup
clean up after remote build
-rw-r--r--pkg/varlinkapi/images.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go
index a1fdf5955..0e1ef5b76 100644
--- a/pkg/varlinkapi/images.go
+++ b/pkg/varlinkapi/images.go
@@ -142,7 +142,14 @@ func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildI
return call.ReplyErrorOccurred(fmt.Sprintf("unable to untar context dir %s", contextDir))
}
logrus.Debugf("untar of %s successful", contextDir)
-
+ defer func() {
+ if err := os.Remove(contextDir); err != nil {
+ logrus.Errorf("unable to delete file '%s': %q", contextDir, err)
+ }
+ if err := os.RemoveAll(newContextDir); err != nil {
+ logrus.Errorf("unable to delete directory '%s': %q", newContextDir, err)
+ }
+ }()
// All output (stdout, stderr) is captured in output as well
var output bytes.Buffer