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

Add error checks #1432

Merged
merged 1 commit into from
Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/fluxctl/release_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ func (opts *controllerReleaseOpts) RunE(cmd *cobra.Command, args []string) error
Cause: opts.cause,
Spec: spec,
})
if err != nil {
fmt.Fprintln(cmd.OutOrStderr(), err.Error())
return nil
}

opts.dryRun = false
}
Expand Down
8 changes: 7 additions & 1 deletion daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/weaveworks/flux"
"github.com/weaveworks/flux/api"
"github.com/weaveworks/flux/api/v10"
"github.com/weaveworks/flux/api/v11"
"github.com/weaveworks/flux/api/v6"
"github.com/weaveworks/flux/api/v9"
"github.com/weaveworks/flux/cluster"
Expand All @@ -27,7 +28,6 @@ import (
"github.com/weaveworks/flux/release"
"github.com/weaveworks/flux/resource"
"github.com/weaveworks/flux/update"
"github.com/weaveworks/flux/api/v11"
)

const (
Expand Down Expand Up @@ -175,12 +175,18 @@ func (d *Daemon) ListImagesWithOptions(ctx context.Context, opts v10.ListImagesO
var err error
if opts.Spec == update.ResourceSpecAll {
services, err = d.Cluster.AllControllers("")
if err != nil {
return nil, errors.Wrap(err, "getting all controllers")
}
} else {
id, err := opts.Spec.AsID()
if err != nil {
return nil, errors.Wrap(err, "treating service spec as ID")
}
services, err = d.Cluster.SomeControllers([]flux.ResourceID{id})
if err != nil {
return nil, errors.Wrap(err, "getting some controllers")
}
}

resources, _, err := d.getResources(ctx)
Expand Down
4 changes: 3 additions & 1 deletion git/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ func TestOnelinelog_WithGitpath(t *testing.T) {
func TestCheckPush(t *testing.T) {
upstreamDir, upstreamCleanup := testfiles.TempDir(t)
defer upstreamCleanup()
err := createRepo(upstreamDir, []string{"config"})
if err := createRepo(upstreamDir, []string{"config"}); err != nil {
t.Fatal(err)
}

cloneDir, cloneCleanup := testfiles.TempDir(t)
defer cloneCleanup()
Expand Down
3 changes: 3 additions & 0 deletions remote/rpc/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ func listImagesWithOptions(ctx context.Context, client listImagesWithoutOptionsC
ns, _, _ = resourceID.Components()
}
services, err := client.ListServices(ctx, ns)
if err != nil {
return statuses, err
}

policyMap := map[flux.ResourceID]map[string]string{}
for _, service := range services {
Expand Down