Fix major version upgrade return code (#2056)

Fix major version upgrade return code
This commit is contained in:
Jan Mussler 2022-09-21 15:25:24 +02:00 committed by GitHub
parent e0c4603057
commit b48034d762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -117,10 +117,10 @@ func (c *Cluster) majorVersionUpgrade() error {
var result string
if resultIdCheck != "0" {
c.logger.Infof("User id was identified as: %s, hence default user is non-root already", resultIdCheck)
result, err = c.ExecCommand(podName, "/bin/bash", "-c", upgradeCommand)
result, err = c.ExecCommand(podName, "/bin/bash", "-o", "pipefail", "-c", upgradeCommand)
} else {
c.logger.Infof("User id was identified as: %s, using su to reach the postgres user", resultIdCheck)
result, err = c.ExecCommand(podName, "/bin/su", "postgres", "-c", upgradeCommand)
result, err = c.ExecCommand(podName, "/bin/su", "postgres", "-o", "pipefail", "-c", upgradeCommand)
}
if err != nil {
c.eventRecorder.Eventf(c.GetReference(), v1.EventTypeWarning, "Major Version Upgrade", "Upgrade from %d to %d FAILED: %v", c.currentMajorVersion, desiredVersion, err)