Skip to content

Commit

Permalink
Storage cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Jun 7, 2017
1 parent 3da63b1 commit fe55a08
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion server/storage/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,5 +384,5 @@ func entryKey(gun data.GUN, role data.RoleName, channel *Channel) string {
}

func checksumKey(gun data.GUN) string {
return fmt.Sprintf("%s", gun)
return gun.String()
}
22 changes: 12 additions & 10 deletions server/storage/sql_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ func (c Channel) TableName() string {
return ChannelTableName
}

// Published is the channel all fully signed, validated metadata lives in
var Published = Channel{
ID: 1,
Name: "published",
}
var (
// Published is the channel all fully signed, validated metadata lives in
Published = Channel{
ID: 1,
Name: "published",
}

// Staged is the channel all partially signed metadata lives in
var Staged = Channel{
ID: 2,
Name: "staged",
}
// Staged is the channel all partially signed metadata lives in
Staged = Channel{
ID: 2,
Name: "staged",
}
)

// TUFFile represents a TUF file in the database
type TUFFile struct {
Expand Down
3 changes: 2 additions & 1 deletion tuf/data/targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package data
import (
"errors"
"fmt"
"path"

"github.com/docker/go/canonical/json"
)
Expand Down Expand Up @@ -42,7 +43,7 @@ func isValidTargetsStructure(t Targets, roleName RoleName) error {
}

for _, roleObj := range t.Delegations.Roles {
if !IsDelegation(roleObj.Name) {
if !IsDelegation(roleObj.Name) || path.Dir(roleObj.Name.String()) != roleName.String() {
return ErrInvalidMetadata{
role: roleName, msg: fmt.Sprintf("delegation role %s invalid", roleObj.Name)}
}
Expand Down

0 comments on commit fe55a08

Please sign in to comment.