Log command.
This commit is contained in:
parent
0d9a4fb6f4
commit
c059ab7527
|
|
@ -58,6 +58,7 @@ func (c *Cluster) majorVersionUpgrade() error {
|
|||
|
||||
if ps.State != "running" {
|
||||
allRunning = false
|
||||
c.logger.Infof("identified non running pod, potentially skipping major version upgrade")
|
||||
}
|
||||
|
||||
if ps.Role == "master" {
|
||||
|
|
@ -69,11 +70,13 @@ func (c *Cluster) majorVersionUpgrade() error {
|
|||
numberOfPods := len(pods)
|
||||
if allRunning && masterPod != nil {
|
||||
desiredVersion := c.GetDesiredMajorVersionAsInt()
|
||||
c.logger.Infof("cluster healthy with version: %d desired: %d", c.currentMajorVersion, desiredVersion)
|
||||
c.logger.Infof("healthy cluster, version: %d desired: %d", c.currentMajorVersion, desiredVersion)
|
||||
if c.currentMajorVersion < desiredVersion {
|
||||
podName := &spec.NamespacedName{Namespace: masterPod.Namespace, Name: masterPod.Name}
|
||||
c.logger.Infof("triggering major version upgrade on pod %s", masterPod.Name)
|
||||
_, err := c.ExecCommand(podName, fmt.Sprintf("su postgres -c \"python3 /scripts/inplace_upgrade.py %d 2>&1 | tee last_upgrade.log\"", numberOfPods))
|
||||
command := fmt.Sprintf("su postgres -c \"python3 /scripts/inplace_upgrade.py %d 2>&1 | tee last_upgrade.log\"", numberOfPods)
|
||||
c.logger.Info("executing: %s", command)
|
||||
_, err := c.ExecCommand(podName, command)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue