Skip to content

Commit

Permalink
Delete temp dirs
Browse files Browse the repository at this point in the history
Signed-off-by: Parthvi Vala <pvala@redhat.com>
  • Loading branch information
valaparthvi committed Mar 21, 2023
1 parent 2330428 commit d9f25dc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ func (o RegistryClient) DownloadStarterProject(starterProject *devfilev1.Starter
if err != nil {
return err
}

defer func() {
err = o.fsys.RemoveAll(starterProjectTmpDir)
if err != nil {
klog.V(2).Infof("failed to delete temporary starter project dir %s; cause: %s", starterProjectTmpDir, err.Error())
}
}()
err = DownloadStarterProject(o.fsys, starterProject, decryptedToken, starterProjectTmpDir, verbose)
if err != nil {
return err
Expand Down Expand Up @@ -402,6 +407,12 @@ func (o RegistryClient) retrieveDevfileDataFromRegistry(ctx context.Context, reg
if err != nil {
return api.DevfileData{}, err
}
defer func() {
err = o.fsys.RemoveAll(tmpFile)
if err != nil {
klog.V(2).Infof("failed to delete temporary starter project dir %s; cause: %s", tmpFile, err.Error())
}
}()

registries, err := o.GetDevfileRegistries(registryName)
if err != nil {
Expand Down

0 comments on commit d9f25dc

Please sign in to comment.