From a438e9de54200d3d54cb99db30e53f496af68a73 Mon Sep 17 00:00:00 2001 From: shilinlee <836160610@qq.com> Date: Thu, 16 Nov 2023 15:31:04 +0800 Subject: [PATCH] fix: download openGemini package if not exist Signed-off-by: shilinlee <836160610@qq.com> --- pkg/cluster/operation/download.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/cluster/operation/download.go b/pkg/cluster/operation/download.go index 51ae83c..bc45eb6 100644 --- a/pkg/cluster/operation/download.go +++ b/pkg/cluster/operation/download.go @@ -113,9 +113,12 @@ func (d *GeminiDownloader) isExistedFile() (bool, error) { fs, err := ioutil.ReadDir(dir) if err != nil { return false, err - } else if len(fs) != 1 { + } else if len(fs) > 1 { return false, fmt.Errorf("more than one offline installation package file at %s", dir) + } else if len(fs) == 0 { + return false, nil } + // offline installation package d.fileName = filepath.Join(dir, fs[0].Name()) return true, nil }