Skip to content

Commit

Permalink
refactor: replace Repo.RawMeta with Repo.GetMeta
Browse files Browse the repository at this point in the history
Signed-off-by: Zachary Newman <z@znewman.net>
  • Loading branch information
znewman01 authored and trishankatdatadog committed Aug 4, 2022
1 parent 4ed09aa commit 5986295
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 4 additions & 2 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 3 additions & 7 deletions repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

0 comments on commit 5986295

Please sign in to comment.