Skip to content

Commit

Permalink
targets-show: Fixes #14
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Doan <andy@foundries.io>
  • Loading branch information
doanac committed Jan 23, 2020
1 parent cd52b2d commit 9caf8db
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cmd/targets_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func doTargetsShow(cmd *cobra.Command, args []string) {
hashes := make(map[string]string)
var tags []string
var apps map[string]client.DockerApp
for _, target := range targets.Signed.Targets {
for name, target := range targets.Signed.Targets {
custom, err := api.TargetCustom(target)
if err != nil {
fmt.Printf("ERROR: %s\n", err)
Expand All @@ -52,17 +52,15 @@ func doTargetsShow(cmd *cobra.Command, args []string) {
logrus.Debugf("Skipping non-ostree target: %v", target)
continue
}
for _, hwid := range custom.HardwareIds {
hashes[hwid] = hex.EncodeToString(target.Hashes["sha256"])
}
hashes[name] = hex.EncodeToString(target.Hashes["sha256"])
apps = custom.DockerApps
tags = custom.Tags
}

fmt.Printf("Tags:\t%s\n\n", strings.Join(tags, ","))

t := tabby.New()
t.AddHeader("HARDWARE ID", "OSTREE HASH - SHA256")
t.AddHeader("TARGET NAME", "OSTREE HASH - SHA256")
for name, val := range hashes {
t.AddLine(name, val)
}
Expand Down

0 comments on commit 9caf8db

Please sign in to comment.