forked from TrueCloudLab/frostfs-node
[#1622] adm: Return non zero return code if metabase upgrade failed
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
57dc0a8e9e
commit
78bfd12229
1 changed files with 7 additions and 1 deletions
|
@ -28,6 +28,7 @@ const (
|
||||||
var (
|
var (
|
||||||
errNoPathsFound = errors.New("no metabase paths found")
|
errNoPathsFound = errors.New("no metabase paths found")
|
||||||
errNoMorphEndpointsFound = errors.New("no morph endpoints found")
|
errNoMorphEndpointsFound = errors.New("no morph endpoints found")
|
||||||
|
errUpgradeFailed = errors.New("upgrade failed")
|
||||||
)
|
)
|
||||||
|
|
||||||
var UpgradeCmd = &cobra.Command{
|
var UpgradeCmd = &cobra.Command{
|
||||||
|
@ -91,14 +92,19 @@ func upgrade(cmd *cobra.Command, _ []string) error {
|
||||||
if err := eg.Wait(); err != nil {
|
if err := eg.Wait(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
allSuccess := true
|
||||||
for mb, ok := range result {
|
for mb, ok := range result {
|
||||||
if ok {
|
if ok {
|
||||||
cmd.Println(mb, ": success")
|
cmd.Println(mb, ": success")
|
||||||
} else {
|
} else {
|
||||||
cmd.Println(mb, ": failed")
|
cmd.Println(mb, ": failed")
|
||||||
|
allSuccess = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
if allSuccess {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errUpgradeFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMetabasePaths(appCfg *config.Config) ([]string, error) {
|
func getMetabasePaths(appCfg *config.Config) ([]string, error) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue