Updates hashicorp/scada-client.
This commit is contained in:
parent
6ca99530fa
commit
1f46758761
24
vendor/github.com/hashicorp/scada-client/.gitignore
generated
vendored
24
vendor/github.com/hashicorp/scada-client/.gitignore
generated
vendored
|
@ -1,24 +0,0 @@
|
|||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
35
vendor/github.com/hashicorp/scada-client/scada/scada.go
generated
vendored
35
vendor/github.com/hashicorp/scada-client/scada/scada.go
generated
vendored
|
@ -13,13 +13,6 @@ import (
|
|||
sc "github.com/hashicorp/scada-client"
|
||||
)
|
||||
|
||||
const (
|
||||
InfrastructureResource = "infrastructures"
|
||||
BoxesResource = "boxes"
|
||||
SharesResource = "shares"
|
||||
NomadClusterResource = "nomad-cluster"
|
||||
)
|
||||
|
||||
// Provider wraps scada-client.Provider to allow most applications to only pull
|
||||
// in this package
|
||||
type Provider struct {
|
||||
|
@ -85,6 +78,20 @@ func providerConfig(c *Config) *sc.ProviderConfig {
|
|||
Token: c.Atlas.Token,
|
||||
}
|
||||
|
||||
// SCADA_INSECURE env variable is used for testing to disable TLS
|
||||
// certificate verification.
|
||||
insecure := c.Insecure
|
||||
if !insecure {
|
||||
if os.Getenv("SCADA_INSECURE") != "" {
|
||||
insecure = true
|
||||
}
|
||||
}
|
||||
if insecure {
|
||||
ret.TLSConfig = &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
|
@ -99,20 +106,6 @@ func NewHTTPProvider(c *Config, logOutput io.Writer) (*Provider, net.Listener, e
|
|||
// Set the HTTP capability
|
||||
config.Service.Capabilities["http"] = 1
|
||||
|
||||
// SCADA_INSECURE env variable is used for testing to disable TLS
|
||||
// certificate verification.
|
||||
insecure := c.Insecure
|
||||
if !insecure {
|
||||
if os.Getenv("SCADA_INSECURE") != "" {
|
||||
insecure = true
|
||||
}
|
||||
}
|
||||
if insecure {
|
||||
config.TLSConfig = &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
}
|
||||
}
|
||||
|
||||
// Create an HTTP listener and handler
|
||||
list := newScadaListener(c.Atlas.Infrastructure)
|
||||
config.Handlers["http"] = func(capability string, meta map[string]string,
|
||||
|
|
123
vendor/github.com/hashicorp/scada-client/scada/scada_test.go
generated
vendored
123
vendor/github.com/hashicorp/scada-client/scada/scada_test.go
generated
vendored
|
@ -1,123 +0,0 @@
|
|||
package scada
|
||||
|
||||
import (
|
||||
"net"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/scada-client"
|
||||
)
|
||||
|
||||
func TestProviderService(t *testing.T) {
|
||||
conf := &Config{
|
||||
Version: "0.5.0rc1",
|
||||
Service: "nomad",
|
||||
ResourceType: NomadClusterResource,
|
||||
Meta: map[string]string{
|
||||
"auto-join": "true",
|
||||
"region": "global",
|
||||
"datacenter": "dc1",
|
||||
"client": "false",
|
||||
"server": "true",
|
||||
},
|
||||
}
|
||||
|
||||
ps := providerService(conf)
|
||||
|
||||
expect := &client.ProviderService{
|
||||
Service: "nomad",
|
||||
ServiceVersion: "0.5.0rc1",
|
||||
Capabilities: map[string]int{},
|
||||
Meta: map[string]string{
|
||||
"auto-join": "true",
|
||||
"region": "global",
|
||||
"datacenter": "dc1",
|
||||
"client": "false",
|
||||
"server": "true",
|
||||
},
|
||||
ResourceType: "nomad-cluster",
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(ps, expect) {
|
||||
t.Fatalf("bad: %v", ps)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProviderConfig(t *testing.T) {
|
||||
conf := &Config{
|
||||
Version: "0.5.0rc1",
|
||||
Service: "nomad",
|
||||
ResourceType: NomadClusterResource,
|
||||
Meta: map[string]string{
|
||||
"auto-join": "true",
|
||||
"region": "global",
|
||||
"datacenter": "dc1",
|
||||
"client": "false",
|
||||
"server": "true",
|
||||
},
|
||||
}
|
||||
|
||||
conf.Atlas = AtlasConfig{
|
||||
Infrastructure: "armon/test",
|
||||
Token: "foobarbaz",
|
||||
Endpoint: "foo.bar:1111",
|
||||
}
|
||||
|
||||
pc := providerConfig(conf)
|
||||
|
||||
expect := &client.ProviderConfig{
|
||||
Service: &client.ProviderService{
|
||||
Service: "nomad",
|
||||
ServiceVersion: "0.5.0rc1",
|
||||
Capabilities: map[string]int{},
|
||||
Meta: map[string]string{
|
||||
"auto-join": "true",
|
||||
"region": "global",
|
||||
"datacenter": "dc1",
|
||||
"client": "false",
|
||||
"server": "true",
|
||||
},
|
||||
ResourceType: "nomad-cluster",
|
||||
},
|
||||
Handlers: map[string]client.CapabilityProvider{},
|
||||
Endpoint: "foo.bar:1111",
|
||||
ResourceGroup: "armon/test",
|
||||
Token: "foobarbaz",
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(pc, expect) {
|
||||
t.Fatalf("bad: %v", pc)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSCADAListener(t *testing.T) {
|
||||
list := newScadaListener("armon/test")
|
||||
defer list.Close()
|
||||
|
||||
var raw interface{} = list
|
||||
_, ok := raw.(net.Listener)
|
||||
if !ok {
|
||||
t.Fatalf("bad")
|
||||
}
|
||||
|
||||
a, b := net.Pipe()
|
||||
defer a.Close()
|
||||
defer b.Close()
|
||||
|
||||
go list.Push(a)
|
||||
out, err := list.Accept()
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if out != a {
|
||||
t.Fatalf("bad")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSCADAAddr(t *testing.T) {
|
||||
var addr interface{} = &scadaAddr{"armon/test"}
|
||||
_, ok := addr.(net.Addr)
|
||||
if !ok {
|
||||
t.Fatalf("bad")
|
||||
}
|
||||
}
|
8
vendor/vendor.json
vendored
8
vendor/vendor.json
vendored
|
@ -368,12 +368,16 @@
|
|||
"revisionTime": "2015-02-01T20:08:39Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "u9qHbpIgMZ7/fjO0gFfds2m/1ck=",
|
||||
"path": "github.com/hashicorp/scada-client",
|
||||
"revision": "84989fd23ad4cc0e7ad44d6a871fd793eb9beb0a"
|
||||
"revision": "6e896784f66f82cdc6f17e00052db91699dc277d",
|
||||
"revisionTime": "2016-06-01T22:40:23Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "fv3nX1vDZViW0tA7Aa5Va2lBUtM=",
|
||||
"path": "github.com/hashicorp/scada-client/scada",
|
||||
"revision": "84989fd23ad4cc0e7ad44d6a871fd793eb9beb0a"
|
||||
"revision": "6e896784f66f82cdc6f17e00052db91699dc277d",
|
||||
"revisionTime": "2016-06-01T22:40:23Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "E3Xcanc9ouQwL+CZGOUyA/+giLg=",
|
||||
|
|
Loading…
Reference in a new issue