Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #861 from weaveworks/images-error
Browse files Browse the repository at this point in the history
Supply a reason for "available images" being blank
  • Loading branch information
squaremo authored Jan 24, 2018
2 parents 0ea578a + 8b480fb commit 9ce750a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
7 changes: 6 additions & 1 deletion cmd/fluxctl/list_images_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/spf13/cobra"

"github.com/weaveworks/flux"
"github.com/weaveworks/flux/registry"
"github.com/weaveworks/flux/update"
)

Expand Down Expand Up @@ -90,7 +91,11 @@ func (opts *controllerShowOpts) RunE(cmd *cobra.Command, args []string) error {
reg += "/"
}
if len(container.Available) == 0 {
fmt.Fprintf(out, "%s\t%s\t%s%s\twaiting for cache\n", controllerName, containerName, reg, repo)
availableErr := container.AvailableError
if availableErr == "" {
availableErr = registry.ErrNoImageData.Error()
}
fmt.Fprintf(out, "%s\t%s\t%s%s\t%s\n", controllerName, containerName, reg, repo, availableErr)
} else {
fmt.Fprintf(out, "%s\t%s\t%s%s\t\n", controllerName, containerName, reg, repo)
}
Expand Down
7 changes: 6 additions & 1 deletion daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,17 @@ func containersWithAvailable(service cluster.Controller, images update.ImageMap)
for _, c := range service.ContainersOrNil() {
im, _ := image.ParseRef(c.Image)
available := images.Available(im.Name)
availableErr := ""
if available == nil {
availableErr = registry.ErrNoImageData.Error()
}
res = append(res, flux.Container{
Name: c.Name,
Current: image.Info{
ID: im,
},
Available: available,
Available: available,
AvailableError: availableErr,
})
}
return res
Expand Down
7 changes: 4 additions & 3 deletions flux.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,10 @@ type ControllerStatus struct {
}

type Container struct {
Name string
Current image.Info
Available []image.Info
Name string
Current image.Info
Available []image.Info
AvailableError string `json:",omitempty"`
}

// --- config types
Expand Down
6 changes: 3 additions & 3 deletions registry/registry.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package registry

import (
"time"
"errors"

"github.com/weaveworks/flux/image"
)

const (
requestTimeout = 10 * time.Second
var (
ErrNoImageData = errors.New("image data not available")
)

// Registry is a store of image metadata.
Expand Down

0 comments on commit 9ce750a

Please sign in to comment.