Skip to content

Commit

Permalink
modified automate_config.go (#8341)
Browse files Browse the repository at this point in the history
* modified automate_config.go

Signed-off-by: swatign <SwatiGanesh.Naik@Progress.com>

* checking backup gateway

Signed-off-by: swatign <SwatiGanesh.Naik@Progress.com>

* modified backup-gateway plan.sh

Signed-off-by: swatign <SwatiGanesh.Naik@Progress.com>

* modified backup-gateway

Signed-off-by: swatign <SwatiGanesh.Naik@Progress.com>

* removed commented lines

Signed-off-by: swatign <SwatiGanesh.Naik@Progress.com>

---------

Signed-off-by: swatign <SwatiGanesh.Naik@Progress.com>
  • Loading branch information
swatiganesh committed Apr 16, 2024
1 parent ab8163a commit 4dfa7fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
27 changes: 19 additions & 8 deletions components/automate-deployment/pkg/client/automate_config.go
Expand Up @@ -3,6 +3,7 @@ package client
import (
"context"
"fmt"
"os"
"os/exec"
"regexp"
"strings"
Expand All @@ -16,15 +17,15 @@ import (
"github.com/chef/automate/components/automate-deployment/pkg/cli"
)

var backupPathFix = `sleep 5
var backupPathFix = `#!/bin/sh
sleep 5
chef-automate status --wait-for-healthy > /dev/null
indices=(
chef-automate-es6-automate-cs-oc-erchef
indices="chef-automate-es6-automate-cs-oc-erchef
chef-automate-es6-compliance-service
chef-automate-es6-event-feed-service
chef-automate-es6-ingest-service
)
for index in ${indices[@]}; do
chef-automate-es6-ingest-service"
for index in $indices; do
curl -XPUT -k -H 'Content-Type: application/json' http://localhost:10144/_snapshot/$index --data-binary @- << EOF
{
"type" : "fs",
Expand Down Expand Up @@ -107,10 +108,20 @@ func PatchAutomateConfig(timeout int64, config *dc.AutomateConfig, writer cli.Fo
if config.Global.V1.Backups.Filesystem.Path.Value != "" && !isOSEnabled {
fmt.Println("Waiting till all the services comes in healthy state...")
backupScript := fmt.Sprintf(backupPathFix, strings.TrimSuffix(config.Global.V1.Backups.Filesystem.Path.Value, "/"))
_, err := exec.Command("/bin/sh", "-c", backupScript).Output()
if err != nil {
cmd := exec.Command("/bin/sh", "-c", backupScript)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

if err := cmd.Start(); err != nil {
fmt.Printf("Failed to start script: %v\n", err)
return status.Wrap(err, status.DeploymentServiceCallError, "Failed attempting to patch Chef Automate configurations")
}

if err := cmd.Wait(); err != nil {
fmt.Printf("Script execution failed with error: %v\n", err)
return status.Wrap(err, status.DeploymentServiceCallError, "Failed attempting to patch Chef Automate configurations")
}

}
}
}
Expand Down
2 changes: 2 additions & 0 deletions components/backup-gateway/habitat/plan.sh
Expand Up @@ -47,3 +47,5 @@ do_strip() {
return 0
}



0 comments on commit 4dfa7fe

Please sign in to comment.