Skip to content

Commit

Permalink
fix: remove the downloaded packages when install failed (#66)
Browse files Browse the repository at this point in the history
* fix: remove the downloaded packages when install failed

Signed-off-by: shilinlee <836160610@qq.com>
  • Loading branch information
shilinlee authored Sep 12, 2024
1 parent 8bd60bc commit 2326400
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 425 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

## Documentation

- [English](https://docs.opengemini.org/guide/reference/gemix/gemix_documentation_guide.html)
- [简体中文](https://docs.opengemini.org/zh/guide/reference/gemix/gemix_documentation_guide)
- [English]()
- [简体中文](https://docs.opengemini.org/zh/guide/reference/gemix_manual.html)

## Installation

Expand All @@ -32,6 +32,11 @@ gemix playground
gemix cluster insall opengemini_demo v1.1.1 ./topology.yaml --skip-create-user -p
```

Tips:

> If there are network issues with the automatic download of the installation package,
> please place the installation package under `~/.gemix/storage/cluster/packages/`
## Usage

After installing `gemix`, you can use it to install binaries of openGemini components and create clusters.
Expand Down
10 changes: 6 additions & 4 deletions pkg/cluster/operation/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ func Download(prefix, component, nodeOS, arch, version string) error {

if component == spec.ComponentGrafana {
// FIXME: download from opengemini.org
fileName = fmt.Sprintf("%s-%s.%s-%s.tar.gz", component, ver.GrafanaVersion, nodeOS, arch)
if nodeOS == "darwin" {
arch = "amd64"
}
fileName = fmt.Sprintf("%s-enterprise-%s.%s-%s.tar.gz", component, ver.GrafanaVersion, nodeOS, arch)
componentUrl = strings.Join([]string{"https://dl.grafana.com/oss/release", fileName}, "/")
}
dstPath := spec.ProfilePath(spec.OpenGeminiPackageCacheDir, fileName)
Expand All @@ -55,9 +58,8 @@ func Download(prefix, component, nodeOS, arch, version string) error {

if utils2.IsExist(dstPath) {
if component == spec.ComponentOpenGemini {
if err := repository.VerifyComponent(version, dstPath); err != nil {
_ = os.Remove(dstPath) // nolint
}
// TODO: do not remote package
_ = repository.VerifyComponent(version, dstPath) // nolint
}
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/repository/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ func VerifyComponent(version, target string) error {
checksums := spec.ProfilePath(spec.OpenGeminiPackageCacheDir, CHECKSUMS)
if utils.IsNotExist(checksums) {
if err := tryToDownloadCheckSumsFile(version); err != nil {
return errors.WithStack(err)
// FIXME: assume that the user downloaded the component without problems
return nil
}
}

Expand Down
91 changes: 0 additions & 91 deletions util/clusterInfo.go

This file was deleted.

144 changes: 0 additions & 144 deletions util/connect.go

This file was deleted.

Loading

0 comments on commit 2326400

Please sign in to comment.