Skip to content

Commit

Permalink
Fix Astra bundle unzip (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
george-zubrienko authored Feb 26, 2025
1 parent 3141d20 commit 33290b5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/checkpoint/request/cql_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/base64"
"encoding/json"
"github.com/gocql/gocql"
"github.com/scylladb/gocqlx/v3"
Expand Down Expand Up @@ -46,9 +47,15 @@ func getContent(zipFile *zip.File) ([]byte, error) {
}

func NewAstraCqlStoreConfig(logger klog.Logger, config *AstraBundleConfig) *AstraCqlStoreConfig {
zipReader, err := zip.NewReader(bytes.NewReader([]byte(config.SecureConnectionBundleBase64)), int64(len(config.SecureConnectionBundleBase64)))
bundleBytes, err := base64.StdEncoding.DecodeString(config.SecureConnectionBundleBase64)
if err != nil {
logger.V(0).Error(err, "Astra bundle content cannot be read")
logger.V(0).Error(err, "Astra bundle value is not a valid base64-encoded string")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)
}

zipReader, err := zip.NewReader(bytes.NewReader(bundleBytes), int64(len(config.SecureConnectionBundleBase64)))
if err != nil {
logger.V(0).Error(err, "Astra bundle cannot be unpacked")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)
}

Expand Down

0 comments on commit 33290b5

Please sign in to comment.