diff --git a/managed/yba-installer/cmd/backup.go b/managed/yba-installer/cmd/backup.go index 6ec2c557b384..924a35f6bbf9 100644 --- a/managed/yba-installer/cmd/backup.go +++ b/managed/yba-installer/cmd/backup.go @@ -79,8 +79,8 @@ func CreateReplicatedBackupScript(output, dataDir, pgUser, pgPort string, verbos } args := []string{"create", "--output", output, "--data_dir", dataDir, "--exclude_prometheus", - "--exclude_releases", "--db_username", pgUser, "--db_host", "localhost", - "--db_port", pgPort} + "--exclude_releases", "--disable_version_check", "--db_username", pgUser, + "--db_host", "localhost", "--db_port", pgPort} if verbose { args = append(args, "--verbose") @@ -89,7 +89,7 @@ func CreateReplicatedBackupScript(output, dataDir, pgUser, pgPort string, verbos log.Info("Creating a backup of your Replicated YBA Installation.") out := shell.Run(fileName, args...) if !out.SucceededOrLog() { - log.Warn(out.Error.Error()) + log.Fatal(out.Error.Error()) } } diff --git a/managed/yba-installer/cmd/prometheus.go b/managed/yba-installer/cmd/prometheus.go index d8fd86b6a265..ba96032738d0 100644 --- a/managed/yba-installer/cmd/prometheus.go +++ b/managed/yba-installer/cmd/prometheus.go @@ -407,12 +407,11 @@ func (prom Prometheus) FinishReplicatedMigrate() error { return nil } -func (prom Prometheus) RollbackMigration(uid, gid uint32) error { - rootDir := common.GetReplicatedBaseDir() +func (prom Prometheus) RollbackMigration(uid, gid uint32, replBaseDir string) error { replDirs := []string{ - filepath.Join(rootDir, "prometheusv2"), - filepath.Join(rootDir, "/yugaware/swamper_targets"), - filepath.Join(rootDir, "yugaware/swamper_rules"), + filepath.Join(replBaseDir, "prometheusv2"), + filepath.Join(replBaseDir, "/yugaware/swamper_targets"), + filepath.Join(replBaseDir, "yugaware/swamper_rules"), } for _, dir := range replDirs { if err := common.Chown(dir, fmt.Sprintf("%d", uid), fmt.Sprintf("%d", gid), true); err != nil { diff --git a/managed/yba-installer/cmd/replicated_migrate.go b/managed/yba-installer/cmd/replicated_migrate.go index 991fea9bf100..c78c82f87d68 100644 --- a/managed/yba-installer/cmd/replicated_migrate.go +++ b/managed/yba-installer/cmd/replicated_migrate.go @@ -69,13 +69,15 @@ var replicatedMigrationStart = &cobra.Command{ } // Get the uid and gid used by the prometheus container. This is used for rollback. - entry := config.Get("installRoot") + entry := config.Get("storage_path") var replicatedInstallRoot string if entry == replicatedctl.NilConfigEntry { replicatedInstallRoot = "/opt/yugabyte" } else { replicatedInstallRoot = entry.Value } + common.SetReplicatedBaseDir(replicatedInstallRoot) + state.Replicated.StoragePath = replicatedInstallRoot checkFile := filepath.Join(replicatedInstallRoot, "prometheusv2/queries.active") info, err := os.Stat(checkFile) if err != nil { @@ -342,7 +344,8 @@ func rollbackMigrations(state *ybactlstate.State) error { prom := services[PrometheusServiceName].(Prometheus) err := prom.RollbackMigration( state.Replicated.PrometheusFileUser, - state.Replicated.PrometheusFileUser) + state.Replicated.PrometheusFileUser, + state.Replicated.StoragePath) if err != nil { log.Fatal("Failed to rollback prometheus migration: " + err.Error()) } diff --git a/managed/yba-installer/pkg/common/directory_manager.go b/managed/yba-installer/pkg/common/directory_manager.go index 6895f8376142..4d23df9161ae 100644 --- a/managed/yba-installer/pkg/common/directory_manager.go +++ b/managed/yba-installer/pkg/common/directory_manager.go @@ -243,3 +243,7 @@ func GetSelfSignedCertsDir() string { func GetReplicatedBaseDir() string { return dm.ReplicatedBaseDir() } + +func SetReplicatedBaseDir(dir string) { + dm.replicatedBaseDir = dir +} diff --git a/managed/yba-installer/pkg/ybactlstate/state.go b/managed/yba-installer/pkg/ybactlstate/state.go index 9e7a5355ded4..524225676ef8 100644 --- a/managed/yba-installer/pkg/ybactlstate/state.go +++ b/managed/yba-installer/pkg/ybactlstate/state.go @@ -33,6 +33,7 @@ type PostgresState struct { type ReplicatedMigrationState struct { PrometheusFileUser uint32 `json:"prometheus_file_user"` PrometheusFileGroup uint32 `json:"prometheus_file_group"` + StoragePath string `json:"storage_path"` } func New() *State {