Skip to content

Commit

Permalink
macros works only after 23.3+, #750
Browse files Browse the repository at this point in the history
  • Loading branch information
Slach committed Oct 10, 2023
1 parent b010edc commit d0576f8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/storage/object_disk/object_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ func WriteMetadataToFile(metadata *Metadata, path string) error {

func getObjectDisksCredentials(ctx context.Context, ch *clickhouse.ClickHouse) (map[string]ObjectStorageCredentials, error) {
credentials := make(map[string]ObjectStorageCredentials)
if version, err := ch.GetVersion(ctx); err != nil {
var version int
var err error
if version, err = ch.GetVersion(ctx); err != nil {
return nil, err
} else if version <= 20006000 {
return credentials, nil
Expand All @@ -320,8 +322,11 @@ func getObjectDisksCredentials(ctx context.Context, ch *clickhouse.ClickHouse) (
}
if endPointNode := d.SelectElement("endpoint"); endPointNode != nil {
creds.EndPoint = strings.Trim(endPointNode.InnerText(), "\r\n \t")
if creds.EndPoint, err = ch.ApplyMacros(ctx, creds.EndPoint); err != nil {
return nil, fmt.Errorf("%s -> /%s/storage_configuration/disks/%s apply macros to <endpoint> error: %v", configFile, root.Data, diskName, err)
// macros works only after 23.3+ https://github.com/Altinity/clickhouse-backup/issues/750
if version > 23003000 {
if creds.EndPoint, err = ch.ApplyMacros(ctx, creds.EndPoint); err != nil {
return nil, fmt.Errorf("%s -> /%s/storage_configuration/disks/%s apply macros to <endpoint> error: %v", configFile, root.Data, diskName, err)
}
}
} else {
return nil, fmt.Errorf("%s -> /%s/storage_configuration/disks/%s doesn't contains <endpoint>", configFile, root.Data, diskName)
Expand Down

0 comments on commit d0576f8

Please sign in to comment.