Skip to content

Commit

Permalink
cosmovisor: move binrary to UpgradeBin from directory (fix cosmos#8494)…
Browse files Browse the repository at this point in the history
  • Loading branch information
allthatjazzleo authored Apr 10, 2021
1 parent 7a3a156 commit 04ab271
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cosmovisor/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"strings"

"github.com/hashicorp/go-getter"
"github.com/otiai10/copy"
)

// DoUpgrade will be called after the log message has been parsed and the process has terminated.
Expand Down Expand Up @@ -62,10 +63,19 @@ func DownloadBinary(cfg *Config, info *UpgradeInfo) error {
if err != nil {
dirPath := cfg.UpgradeDir(info.Name)
err = getter.Get(dirPath, url)
if err != nil {
return err
}
err = EnsureBinary(binPath)
// copy binary to binPath from dirPath if zipped directory don't contain bin directory to wrap the binary
if err != nil {
err = copy.Copy(filepath.Join(dirPath, cfg.Name), binPath)
if err != nil {
return err
}
}
}
if err != nil {
return err
}

// if it is successful, let's ensure the binary is executable
return MarkExecutable(binPath)
}
Expand Down

0 comments on commit 04ab271

Please sign in to comment.