Skip to content

Commit

Permalink
Cleanup client options
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
  • Loading branch information
ondrej-fabry committed Sep 27, 2019
1 parent 6d08c03 commit 36c0106
Show file tree
Hide file tree
Showing 18 changed files with 288 additions and 313 deletions.
2 changes: 1 addition & 1 deletion api/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
package api

const (
DefaultVersion = "0.1"
DefaultVersion = ""
)
2 changes: 1 addition & 1 deletion api/types/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ type SchedulerDumpOptions struct {
KeyPrefix string
View string
}
type SchedulerStatusOptions struct {
type SchedulerValuesOptions struct {
KeyPrefix string
}
10 changes: 3 additions & 7 deletions cmd/agentctl/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ import (
"context"
"fmt"
"io"
"net"
"net/http"
"runtime"

"github.com/docker/cli/cli/streams"
"github.com/docker/docker/pkg/term"
"github.com/ligato/cn-infra/logging"
"github.com/sirupsen/logrus"

"github.com/ligato/cn-infra/db/keyval"
"github.com/ligato/cn-infra/db/keyval/kvproto"
"github.com/ligato/cn-infra/logging"

"github.com/ligato/vpp-agent/api"
"github.com/ligato/vpp-agent/cmd/agentctl/client"
Expand Down Expand Up @@ -169,8 +167,7 @@ func (cli *AgentCli) Initialize(opts *ClientOptions, ops ...InitializeOpt) error
}
if opts.Debug {
debug.Enable()
logrus.SetLevel(logrus.DebugLevel)
logging.DefaultLogger.SetLevel(logging.DebugLevel)
SetLogLevel("debug")
} else {
SetLogLevel(opts.LogLevel)
}
Expand All @@ -194,10 +191,9 @@ func newAPIClient(opts *ClientOptions) (client.APIClient, error) {
// No proxy
Transport: &http.Transport{},
}
grpcAddr := net.JoinHostPort(opts.AgentHost, opts.PortGRPC)
clientOpts := []client.Opt{
client.WithHTTPClient(httpClient),
client.WithGRPCAddr(grpcAddr),
client.WithHost(opts.AgentHost),
client.WithEtcdEndpoints(opts.Endpoints),
client.WithServiceLabel(opts.ServiceLabel),
}
Expand Down
6 changes: 4 additions & 2 deletions cmd/agentctl/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import (
"strings"

"github.com/docker/go-connections/tlsconfig"
"github.com/ligato/cn-infra/logging"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"

"github.com/ligato/cn-infra/logging"
"github.com/ligato/vpp-agent/cmd/agentctl/client"
)

const (
Expand All @@ -26,7 +28,7 @@ var (

func init() {
if agentHost == "" {
agentHost = defaultAgentHost
agentHost = client.DefaultAgentHost
}
if len(etcdEndpoints) == 0 || etcdEndpoints[0] == "" {
etcdEndpoints = []string{defaultEtcdEndpoint}
Expand Down
130 changes: 0 additions & 130 deletions cmd/agentctl/cli/opts.go

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/agentctl/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type ModelAPIClient interface {
// SchedulerAPIClient defines API client methods for the scheduler
type SchedulerAPIClient interface {
SchedulerDump(ctx context.Context, opts types.SchedulerDumpOptions) ([]api.KVWithMetadata, error)
SchedulerStatus(ctx context.Context, opts types.SchedulerStatusOptions) ([]*api.BaseValueStatus, error)
SchedulerValues(ctx context.Context, opts types.SchedulerValuesOptions) ([]*api.BaseValueStatus, error)
}

// VppAPIClient
Expand Down
Loading

0 comments on commit 36c0106

Please sign in to comment.