Skip to content

Commit d0576f8

Browse files
committed
macros works only after 23.3+, #750
1 parent b010edc commit d0576f8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pkg/storage/object_disk/object_disk.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ func WriteMetadataToFile(metadata *Metadata, path string) error {
293293

294294
func getObjectDisksCredentials(ctx context.Context, ch *clickhouse.ClickHouse) (map[string]ObjectStorageCredentials, error) {
295295
credentials := make(map[string]ObjectStorageCredentials)
296-
if version, err := ch.GetVersion(ctx); err != nil {
296+
var version int
297+
var err error
298+
if version, err = ch.GetVersion(ctx); err != nil {
297299
return nil, err
298300
} else if version <= 20006000 {
299301
return credentials, nil
@@ -320,8 +322,11 @@ func getObjectDisksCredentials(ctx context.Context, ch *clickhouse.ClickHouse) (
320322
}
321323
if endPointNode := d.SelectElement("endpoint"); endPointNode != nil {
322324
creds.EndPoint = strings.Trim(endPointNode.InnerText(), "\r\n \t")
323-
if creds.EndPoint, err = ch.ApplyMacros(ctx, creds.EndPoint); err != nil {
324-
return nil, fmt.Errorf("%s -> /%s/storage_configuration/disks/%s apply macros to <endpoint> error: %v", configFile, root.Data, diskName, err)
325+
// macros works only after 23.3+ https://github.com/Altinity/clickhouse-backup/issues/750
326+
if version > 23003000 {
327+
if creds.EndPoint, err = ch.ApplyMacros(ctx, creds.EndPoint); err != nil {
328+
return nil, fmt.Errorf("%s -> /%s/storage_configuration/disks/%s apply macros to <endpoint> error: %v", configFile, root.Data, diskName, err)
329+
}
325330
}
326331
} else {
327332
return nil, fmt.Errorf("%s -> /%s/storage_configuration/disks/%s doesn't contains <endpoint>", configFile, root.Data, diskName)

0 commit comments

Comments
 (0)