diff --git a/cas/cas.go b/cas/cas.go index 4383d97..5f72660 100644 --- a/cas/cas.go +++ b/cas/cas.go @@ -217,7 +217,7 @@ func (ds Store) WriteACI(r io.Reader) (string, error) { } // Import the uncompressed image into the store at the real key - key := HashToKey(h) + key := ds.HashToKey(h) if err = ds.stores[blobType].Import(fh.Name(), key, true); err != nil { return "", fmt.Errorf("error importing image: %v", err) } @@ -304,7 +304,7 @@ func (ds Store) Dump(hex bool) { // HashToKey takes a hash.Hash (which currently _MUST_ represent a full SHA512), // calculates its sum, and returns a string which should be used as the key to // store the data matching the hash. -func HashToKey(h hash.Hash) string { +func (ds Store) HashToKey(h hash.Hash) string { s := h.Sum(nil) return keyToString(s) } diff --git a/stage0/run.go b/stage0/run.go index 6eb4040..3972895 100644 --- a/stage0/run.go +++ b/stage0/run.go @@ -278,7 +278,7 @@ func expandImage(cfg PrepareConfig, img types.Hash, dest string) error { } // TODO(jonboulle): clean this up, leaky abstraction with the store. - if g := cas.HashToKey(hash); g != img.String() { + if g := cfg.Store.HashToKey(hash); g != img.String() { return fmt.Errorf("image hash does not match expected (%v != %v)", g, img.String()) }