agent: Rename AtlasCluster to AtlasInfrastructure

pull/711/head
Armon Dadgar 2015-02-06 12:44:55 -08:00
parent b9cdb94f19
commit 8d184a241f
4 changed files with 19 additions and 19 deletions

View File

@ -78,7 +78,7 @@ func (c *Command) readConfig() *Config {
cmdFlags.StringVar(&cmdConfig.BindAddr, "bind", "", "address to bind server listeners to") cmdFlags.StringVar(&cmdConfig.BindAddr, "bind", "", "address to bind server listeners to")
cmdFlags.StringVar(&cmdConfig.AdvertiseAddr, "advertise", "", "address to advertise instead of bind addr") cmdFlags.StringVar(&cmdConfig.AdvertiseAddr, "advertise", "", "address to advertise instead of bind addr")
cmdFlags.StringVar(&cmdConfig.AtlasCluster, "atlas-cluster", "", "cluster name in Atlas") cmdFlags.StringVar(&cmdConfig.AtlasInfrastructure, "atlas", "", "infrastructure name in Atlas")
cmdFlags.StringVar(&cmdConfig.AtlasToken, "atlas-token", "", "authentication token for Atlas") cmdFlags.StringVar(&cmdConfig.AtlasToken, "atlas-token", "", "authentication token for Atlas")
cmdFlags.BoolVar(&cmdConfig.AtlasJoin, "atlas-join", false, "auto-join with Atlas") cmdFlags.BoolVar(&cmdConfig.AtlasJoin, "atlas-join", false, "auto-join with Atlas")
@ -335,7 +335,7 @@ func (c *Command) setupAgent(config *Config, logOutput io.Writer, logWriter *log
// Enable the SCADA integration // Enable the SCADA integration
var scadaList net.Listener var scadaList net.Listener
if config.AtlasCluster != "" { if config.AtlasInfrastructure != "" {
provider, list, err := NewProvider(config, logOutput) provider, list, err := NewProvider(config, logOutput)
if err != nil { if err != nil {
agent.Shutdown() agent.Shutdown()
@ -649,9 +649,9 @@ func (c *Command) Run(args []string) int {
} }
// Determine the Atlas cluster // Determine the Atlas cluster
cluster := config.AtlasCluster atlas := "<disabled>"
if cluster == "" { if config.AtlasInfrastructure != "" {
cluster = "<disabled>" atlas = fmt.Sprintf("(Infrastructure: '%s' Join: %v)", config.AtlasInfrastructure, config.AtlasJoin)
} }
// Let the agent know we've finished registration // Let the agent know we've finished registration
@ -667,7 +667,7 @@ func (c *Command) Run(args []string) int {
config.Ports.SerfLan, config.Ports.SerfWan)) config.Ports.SerfLan, config.Ports.SerfWan))
c.Ui.Info(fmt.Sprintf("Gossip encrypt: %v, RPC-TLS: %v, TLS-Incoming: %v", c.Ui.Info(fmt.Sprintf("Gossip encrypt: %v, RPC-TLS: %v, TLS-Incoming: %v",
gossipEncrypted, config.VerifyOutgoing, config.VerifyIncoming)) gossipEncrypted, config.VerifyOutgoing, config.VerifyIncoming))
c.Ui.Info(fmt.Sprintf(" Atlas Cluster: %v", cluster)) c.Ui.Info(fmt.Sprintf(" Atlas: %s", atlas))
// Enable log streaming // Enable log streaming
c.Ui.Info("") c.Ui.Info("")
@ -842,7 +842,7 @@ Usage: consul agent [options]
Options: Options:
-advertise=addr Sets the advertise address to use -advertise=addr Sets the advertise address to use
-atlas-cluster=org/name Sets the Atlas cluster name, enables SCADA. -atlas=org/name Sets the Atlas infrastructure name, enables SCADA.
-atlas-join Enables auto-joining the Atlas cluster -atlas-join Enables auto-joining the Atlas cluster
-atlas-token=token Provides the Atlas API token -atlas-token=token Provides the Atlas API token
-bootstrap Sets server to bootstrap mode -bootstrap Sets server to bootstrap mode

View File

@ -318,8 +318,8 @@ type Config struct {
// HTTPAPIResponseHeaders are used to add HTTP header response fields to the HTTP API responses. // HTTPAPIResponseHeaders are used to add HTTP header response fields to the HTTP API responses.
HTTPAPIResponseHeaders map[string]string `mapstructure:"http_api_response_headers"` HTTPAPIResponseHeaders map[string]string `mapstructure:"http_api_response_headers"`
// AtlasCluster is the name of the cluster we belong to. e.g. hashicorp/stage // AtlasInfrastructure is the name of the infrastructure we belong to. e.g. hashicorp/stage
AtlasCluster string `mapstructure:"atlas_cluster"` AtlasInfrastructure string `mapstructure:"atlas_infrastructure"`
// AtlasToken is our authentication token from Atlas // AtlasToken is our authentication token from Atlas
AtlasToken string `mapstructure:"atlas_token"` AtlasToken string `mapstructure:"atlas_token"`
@ -958,8 +958,8 @@ func MergeConfig(a, b *Config) *Config {
if b.UnixSockets.Perms != "" { if b.UnixSockets.Perms != "" {
result.UnixSockets.Perms = b.UnixSockets.Perms result.UnixSockets.Perms = b.UnixSockets.Perms
} }
if b.AtlasCluster != "" { if b.AtlasInfrastructure != "" {
result.AtlasCluster = b.AtlasCluster result.AtlasInfrastructure = b.AtlasInfrastructure
} }
if b.AtlasToken != "" { if b.AtlasToken != "" {
result.AtlasToken = b.AtlasToken result.AtlasToken = b.AtlasToken

View File

@ -635,13 +635,13 @@ func TestDecodeConfig(t *testing.T) {
} }
// Atlas configs // Atlas configs
input = `{"atlas_cluster": "hashicorp/prod", "atlas_token": "abcdefg", "atlas_acl_token": "123456789", "atlas_join": true}` input = `{"atlas_infrastructure": "hashicorp/prod", "atlas_token": "abcdefg", "atlas_acl_token": "123456789", "atlas_join": true}`
config, err = DecodeConfig(bytes.NewReader([]byte(input))) config, err = DecodeConfig(bytes.NewReader([]byte(input)))
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
if config.AtlasCluster != "hashicorp/prod" { if config.AtlasInfrastructure != "hashicorp/prod" {
t.Fatalf("bad: %#v", config) t.Fatalf("bad: %#v", config)
} }
if config.AtlasToken != "abcdefg" { if config.AtlasToken != "abcdefg" {
@ -1116,10 +1116,10 @@ func TestMergeConfig(t *testing.T) {
Perms: "0700", Perms: "0700",
}, },
}, },
AtlasCluster: "hashicorp/prod", AtlasInfrastructure: "hashicorp/prod",
AtlasToken: "123456789", AtlasToken: "123456789",
AtlasACLToken: "abcdefgh", AtlasACLToken: "abcdefgh",
AtlasJoin: true, AtlasJoin: true,
} }
c := MergeConfig(a, b) c := MergeConfig(a, b)

View File

@ -47,7 +47,7 @@ func ProviderConfig(c *Config) *client.ProviderConfig {
Handlers: map[string]client.CapabilityProvider{ Handlers: map[string]client.CapabilityProvider{
"http": nil, "http": nil,
}, },
ResourceGroup: c.AtlasCluster, ResourceGroup: c.AtlasInfrastructure,
Token: c.AtlasToken, Token: c.AtlasToken,
} }
} }
@ -67,7 +67,7 @@ func NewProvider(c *Config, logOutput io.Writer) (*client.Provider, net.Listener
// TODO: AtlasACLToken // TODO: AtlasACLToken
// Create an HTTP listener and handler // Create an HTTP listener and handler
list := newScadaListener(c.AtlasCluster) list := newScadaListener(c.AtlasInfrastructure)
config.Handlers["http"] = func(capability string, meta map[string]string, config.Handlers["http"] = func(capability string, meta map[string]string,
conn io.ReadWriteCloser) error { conn io.ReadWriteCloser) error {
return list.PushRWC(conn) return list.PushRWC(conn)