Skip to content

Commit

Permalink
adding defer statement to turn off maintenance mode
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Sharma <[email protected]>
  • Loading branch information
jayvikramsharma1 committed Oct 25, 2023
1 parent 870267d commit 91e7c86
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/automate-cli/cmd/chef-automate/certRotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ func checkLagAndStopTraffic(infra *AutomateHAInfraDetails, sshConfig sshutils.SS
if err != nil {
return err
}
//////////////////////////////////////////////////////////////////////////

if userConsent {
agree, err := writer.Confirm(fmt.Sprintf(MAINTENANICE_ON_LAG, lag))
if err != nil {
Expand All @@ -1291,7 +1291,6 @@ func checkLagAndStopTraffic(infra *AutomateHAInfraDetails, sshConfig sshutils.SS
if err != nil {
return err
}
//////////////////////////////////////////////////////////////////////////

waitingStart := time.Now()
time.Sleep(waitTime * time.Second)
Expand Down Expand Up @@ -1358,6 +1357,14 @@ func (c *certRotateFlow) certRotateFromTemplate(clusterCertificateFile string, s
return err
}

defer func() {
c.log.Debug("==========================================================")
c.log.Debug("Defer Starting traffic MAINTENANICE MODE OFF")
c.log.Debug("==========================================================")
startTrafficOnAutomateNode(infra, configRes, c.sshUtil, c.log)
startTrafficOnChefServerNode(infra, configRes, c.sshUtil, c.log)
}()

if templateCerts != nil {
// rotating PG certs
start := time.Now()
Expand Down

0 comments on commit 91e7c86

Please sign in to comment.