From caff217f6d580818a84498ca7841dab61ecad3da Mon Sep 17 00:00:00 2001 From: zhoujunhao <18853925545@163.com> Date: Thu, 11 Oct 2018 21:51:56 +0800 Subject: [PATCH] [FIX] Fix bug in getting public key --- builder/sources/git.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builder/sources/git.go b/builder/sources/git.go index c4869ebbd..7fffd1635 100644 --- a/builder/sources/git.go +++ b/builder/sources/git.go @@ -423,13 +423,14 @@ func GetPrivateFile(tenantID string) string { if home == "" { home = "/root" } - if tenantID == "builder_rsa" { + if ok, _ := util.FileExists(path.Join(home, "/.ssh/"+tenantID)); ok { + return path.Join(home, "/.ssh/"+tenantID) + } else { if ok, _ := util.FileExists(path.Join(home, "/.ssh/builder_rsa")); ok { return path.Join(home, "/.ssh/builder_rsa") } return path.Join(home, "/.ssh/id_rsa") } - return path.Join(home, "/.ssh/"+tenantID) }