This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit fec2815db264efb21eafa1df3bbaa4238eaafa56
Author: nferraro <ni.ferr...@gmail.com>
AuthorDate: Fri Sep 28 13:07:06 2018 +0200

    Fix error when no shared dir is present in Openshift
---
 pkg/build/packager/base.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pkg/build/packager/base.go b/pkg/build/packager/base.go
index 38cfdc7..a13da83 100644
--- a/pkg/build/packager/base.go
+++ b/pkg/build/packager/base.go
@@ -125,7 +125,12 @@ func (b *commonPackager) execute(request build.Request, 
assembled build.Assemble
 }
 
 func (b *commonPackager) createTar(assembled build.AssembledOutput, 
selectedArtifacts []build.ClasspathEntry) (string, error) {
-       artifactDir, err := ioutil.TempDir(sharedDir, artifactDirPrefix)
+       buildBaseDir := sharedDir
+       if _, err := os.Stat(buildBaseDir); os.IsNotExist(err) {
+               // use default OS temp dir if a shared dir is not present
+               buildBaseDir = ""
+       }
+       artifactDir, err := ioutil.TempDir(buildBaseDir, artifactDirPrefix)
        if err != nil {
                return "", errors.Wrap(err, "could not create temporary dir for 
packaged artifacts")
        }

Reply via email to