From a096bdfc42440a79463d4308435392ac293d40e5 Mon Sep 17 00:00:00 2001 From: Zachary Newman Date: Wed, 3 Aug 2022 15:32:08 -0400 Subject: [PATCH] refactor: replace Repo.RawMeta with Repo.GetMeta Signed-off-by: Zachary Newman --- client/client_test.go | 6 ++++-- repo.go | 10 +++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/client/client_test.go b/client/client_test.go index bb6e15d71..c23a96662 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -175,9 +175,11 @@ func (s *ClientSuite) addRemoteTarget(c *C, name string) { } func (s *ClientSuite) rootMeta(c *C) []byte { - meta, err := s.repo.RawMeta("root.json") + meta, err := s.repo.GetMeta() c.Assert(err, IsNil) - return meta + rootMeta, ok := meta["root.json"] + c.Assert(ok, Equals, true) + return rootMeta } func (s *ClientSuite) newClient(c *C) *Client { diff --git a/repo.go b/repo.go index 7ae49bb73..b4ca62b9a 100644 --- a/repo.go +++ b/repo.go @@ -1592,11 +1592,7 @@ func (r *Repo) CheckRoleUnexpired(role string, validAt time.Time) error { return nil } -// RawMeta returns the bytes from the repo metadata dictionary, as-is -func (r *Repo) RawMeta(roleFilename string) ([]byte, error) { - meta, ok := r.meta[roleFilename] - if !ok { - return nil, ErrMissingMetadata{roleFilename} - } - return meta, nil +// GetMeta returns the underlying meta file map from the store. +func (r *Repo) GetMeta() (map[string]json.RawMessage, error) { + return r.local.GetMeta() }