-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CHEF-11758] Add support for config verification of backup in HA restore command #8661
base: main
Are you sure you want to change the base?
Conversation
👷 Deploy Preview for chef-automate processing.
|
220baac
to
b9d365f
Compare
if osSnapshot.Es6Compliance.Type == backupLocation && osSnapshot.Es6Erchef.Type == backupLocation && osSnapshot.Es6EventFeed.Type == backupLocation && osSnapshot.Es6Ingest.Type == backupLocation { | ||
complianceServicePath = getSnapshotPathDetails(osSnapshot.Es6Compliance.Settings.Location) | ||
erchefServicePath = getSnapshotPathDetails(osSnapshot.Es6Erchef.Settings.Location) | ||
eventFeedServicePath = getSnapshotPathDetails(osSnapshot.Es6EventFeed.Settings.Location) | ||
ingestServicePath = getSnapshotPathDetails(osSnapshot.Es6Ingest.Settings.Location) | ||
if complianceServicePath == erchefServicePath && erchefServicePath == eventFeedServicePath && erchefServicePath == ingestServicePath { | ||
allowRestore = true | ||
snapshotEs6ServicePath = complianceServicePath | ||
} | ||
} else { | ||
err := fmt.Errorf("discrepancy in the backup types. Backup path of all indices should be %s. Refer `https://docs.chef.io/automate/ha_backup_restore_file_system/#troubleshooting` to do a clean up of the snapshot repo", backupLocation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This piece of code is repeated and probably can be made common in the conditions
} | ||
|
||
func getSnapshotPathDetails(snapshotPath string) string { | ||
parts := strings.Split(snapshotPath, "/automate-elasticsearch-data") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please handle the situation here if lets say parts length is zero
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
path := "" | ||
switch backupLocation { | ||
case "fs": | ||
if ele.Global.V1.External.Opensearch.Backup.Fs != nil && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you handle here and below conditions if ele.Global.V1.External and ele.Global.V1.External.Opensearch and ele.Global.V1.External.Opensearch.Backup is not nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Rensy Thomas <[email protected]>
Signed-off-by: Rensy Thomas <[email protected]>
522b500
to
6c05d6f
Compare
Quality Gate failedFailed conditions See analysis details on SonarQube Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
🔩 Description:
Add support for config verification of backup in HA restore command
Jira ID - https://progresssoftware.atlassian.net/browse/CHEF-11758
⛓️ Related Resources
👍 Definition of Done
👟 How to Build and Test the Change
✅ Checklist
All PRs must tick these:
With occasional exceptions, all PRs from Progress employees must tick these:
make spell
in any component directory)All PRs from Progress employees should tick these if appropriate:
Please add a note next to any checkbox above if you are NOT ticking it.
📷 Screenshots, if applicable
Error message when backup path in automate node does not match with the backup path configured in opensearch node
Error message when backup path in automate node does not match with the indices of snapshots
Error message when indices of all the snapshots are not the same
Success message