Skip to content

Commit 5986295

Browse files
znewman01trishankatdatadog
authored andcommitted
refactor: replace Repo.RawMeta with Repo.GetMeta
Signed-off-by: Zachary Newman <[email protected]>
1 parent 4ed09aa commit 5986295

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

client/client_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,11 @@ func (s *ClientSuite) addRemoteTarget(c *C, name string) {
175175
}
176176

177177
func (s *ClientSuite) rootMeta(c *C) []byte {
178-
meta, err := s.repo.RawMeta("root.json")
178+
meta, err := s.repo.GetMeta()
179179
c.Assert(err, IsNil)
180-
return meta
180+
rootMeta, ok := meta["root.json"]
181+
c.Assert(ok, Equals, true)
182+
return rootMeta
181183
}
182184

183185
func (s *ClientSuite) newClient(c *C) *Client {

repo.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,11 +1592,7 @@ func (r *Repo) CheckRoleUnexpired(role string, validAt time.Time) error {
15921592
return nil
15931593
}
15941594

1595-
// RawMeta returns the bytes from the repo metadata dictionary, as-is
1596-
func (r *Repo) RawMeta(roleFilename string) ([]byte, error) {
1597-
meta, ok := r.meta[roleFilename]
1598-
if !ok {
1599-
return nil, ErrMissingMetadata{roleFilename}
1600-
}
1601-
return meta, nil
1595+
// GetMeta returns the underlying meta file map from the store.
1596+
func (r *Repo) GetMeta() (map[string]json.RawMessage, error) {
1597+
return r.local.GetMeta()
16021598
}

0 commit comments

Comments
 (0)