Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build error in examples/go-client #3547

Merged
merged 2 commits into from
Apr 9, 2020
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
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,10 @@ run-docs:
# tests everything: called by Jenkins
#
.PHONY: test
test: FLAGS ?=
test: FLAGS ?= '-race'
test: PACKAGES := $(shell go list ./... | grep -v integration)
test: $(VERSRC)
go test -tags "$(PAM_TAG) $(FIPS_TAG) $(BPF_TAG)" ./tool/tsh/... \
./lib/... \
./tool/teleport... $(FLAGS) $(ADDFLAGS)
go vet ./tool/... ./lib/...
go test -tags "$(PAM_TAG) $(FIPS_TAG) $(BPF_TAG)" $(PACKAGES) $(FLAGS) $(ADDFLAGS)

#
# integration tests. need a TTY to work and not compatible with a race detector
Expand Down
12 changes: 7 additions & 5 deletions examples/go-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package main

import (
"context"
"crypto/tls"
"log"
"path/filepath"
Expand All @@ -33,13 +34,14 @@ func main() {

// Teleport HTTPS client uses TLS client authentication
// so we have to set up certificates there
tlsConfig, err := setupClientTLS()
tlsConfig, err := setupClientTLS(context.Background())
if err != nil {
log.Fatalf("Failed to parse TLS config: %v", err)
}

authServerAddr := []utils.NetAddr{*utils.MustParseAddr("127.0.0.1:3025")}
client, err := auth.NewTLSClient(authServerAddr, tlsConfig)
clientConfig := auth.ClientConfig{Addrs: authServerAddr, TLS: tlsConfig}

client, err := auth.NewTLSClient(clientConfig)
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
Expand All @@ -61,8 +63,8 @@ func main() {
// and Teleport Auth server. This function uses hardcoded certificate paths,
// assuming program runs alongside auth server, but it can be ran
// on a remote location, assuming client has all the client certificates.
func setupClientTLS() (*tls.Config, error) {
storage, err := auth.NewProcessStorage(filepath.Join("/var/lib/teleport", teleport.ComponentProcess))
func setupClientTLS(ctx context.Context) (*tls.Config, error) {
storage, err := auth.NewProcessStorage(ctx, filepath.Join("/var/lib/teleport", teleport.ComponentProcess))
if err != nil {
return nil, trace.Wrap(err)
}
Expand Down