Skip to content

Commit

Permalink
Login to Turbo API server before starting the TAP Service (#55)
Browse files Browse the repository at this point in the history
* OM-37253 Tap service to execute login to get session cookie from the turbo client before adding target
  • Loading branch information
pallavidn authored Aug 17, 2018
1 parent 1540839 commit 6bcd87d
Show file tree
Hide file tree
Showing 60 changed files with 10,542 additions and 3,727 deletions.
44 changes: 0 additions & 44 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

84 changes: 84 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
branch = "master"
name = "github.com/golang/glog"

[[constraint]]
name = "github.com/golang/protobuf"
version = "1.1.0"

[[constraint]]
name = "github.com/gorilla/websocket"
version = "1.2.0"

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.2"

[[constraint]]
branch = "master"
name = "github.com/turbonomic/turbo-api"

[[constraint]]
branch = "master"
name = "golang.org/x/net"

[prune]
go-tests = true
unused-packages = true
14 changes: 14 additions & 0 deletions pkg/service/tap_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ func (tapService *TAPService) addTarget(isRegistered chan bool) {

func (tapService *TAPService) ConnectToTurbo() {
glog.V(4).Infof("[ConnectToTurbo] Enter ******* ")

if tapService.RESTClient == nil {
glog.V(1).Infof("TAP service cannot be started - cannot create target")
return
}

tapService.disconnectFromTurbo = make(chan struct{})
isRegistered := make(chan bool, 1)
defer close(isRegistered)
Expand Down Expand Up @@ -145,6 +151,14 @@ func (builder *TAPServiceBuilder) WithTurboCommunicator(commConfig *TurboCommuni
return builder
}
glog.V(4).Infof("The Turbo API client is create successfully: %v", apiClient)

// Login to obtain the session cookie
_, err = apiClient.Login()
if err != nil {
glog.Errorf("Cannot login to the Turbo API Client: %v", err)
return builder
}

builder.tapService.Client = apiClient

return builder
Expand Down
4 changes: 3 additions & 1 deletion vendor/github.com/davecgh/go-spew/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions vendor/github.com/davecgh/go-spew/spew/bypass.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions vendor/github.com/davecgh/go-spew/spew/bypasssafe.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/davecgh/go-spew/spew/common.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions vendor/github.com/davecgh/go-spew/spew/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion vendor/github.com/davecgh/go-spew/spew/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vendor/github.com/davecgh/go-spew/spew/dump.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/davecgh/go-spew/spew/format.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/davecgh/go-spew/spew/spew.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/golang/glog/README

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion vendor/github.com/golang/glog/glog.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6bcd87d

Please sign in to comment.