Skip to content

Commit

Permalink
Ensure stanza gets created
Browse files Browse the repository at this point in the history
When an objectstore repo is added first and
then a repo host, the pgbackrest stanza would
not be created. This commit fixes the issue.
  • Loading branch information
Anthony Landreth committed Jul 31, 2024
1 parent 5f07d66 commit 8e3fdba
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/pgbackrest/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ func CalculateConfigHashes(
var err error
repoConfigHashes := make(map[string]string)
for _, repo := range postgresCluster.Spec.Backups.PGBackRest.Repos {
// hashes are only calculated for external repo configs
if repo.Volume != nil {
continue
}
// hashes are calculated for external repo configs and volume names

var hash, name string
switch {
case repo.Azure != nil:
hash, err = hashFunc([]string{repo.Azure.Container})
hash, err = hashFunc([]string{repo.Name, repo.Azure.Container})
name = repo.Name
case repo.GCS != nil:
hash, err = hashFunc([]string{repo.GCS.Bucket})
hash, err = hashFunc([]string{repo.Name, repo.GCS.Bucket})
name = repo.Name
case repo.S3 != nil:
hash, err = hashFunc([]string{repo.S3.Bucket, repo.S3.Endpoint, repo.S3.Region})
hash, err = hashFunc([]string{repo.Name, repo.S3.Bucket, repo.S3.Endpoint, repo.S3.Region})
name = repo.Name
case repo.Volume != nil:
hash, err = hashFunc([]string{repo.Name})
name = repo.Name
default:
return map[string]string{}, "", errors.New("found unexpected repo type")
Expand Down

0 comments on commit 8e3fdba

Please sign in to comment.