From e0461c754985a7998025a64a41715fa1f2d99913 Mon Sep 17 00:00:00 2001 From: JChien Date: Wed, 17 Dec 2014 15:28:42 +0800 Subject: [PATCH] fix readme and remove swarm prefix Signed-off-by: JChien --- discovery/README.md | 10 +++------- discovery/consul/consul.go | 4 +--- discovery/consul/consul_test.go | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/discovery/README.md b/discovery/README.md index 11723047c8..235523adee 100644 --- a/discovery/README.md +++ b/discovery/README.md @@ -81,17 +81,13 @@ http:// ###### Using consul ```bash -# create a cluster -$ swarm create -6856663cdefdec325839a4b7e1de38e8 - # on each of your nodes, start the swarm agent # doesn't have to be public (eg. 192.168.0.X), # as long as the other nodes can reach it, it is fine. -$ swarm join --discovery consul:///>6856663cdefdec325839a4b7e1de38e8> --addr= +$ swarm join --discovery consul:/// --addr= # start the manager on any machine or your laptop -$ swarm manage --discovery consul:///>6856663cdefdec325839a4b7e1de38e8> --addr= +$ swarm manage --discovery consul:/// --addr= # use the regular docker cli $ docker -H info @@ -101,7 +97,7 @@ $ docker -H logs ... ... # list nodes in your cluster -$ swarm list --discovery consul:///>path> +$ swarm list --discovery consul:/// http:// ``` diff --git a/discovery/consul/consul.go b/discovery/consul/consul.go index 591fbe9952..b1c7883c9e 100644 --- a/discovery/consul/consul.go +++ b/discovery/consul/consul.go @@ -16,8 +16,6 @@ type ConsulDiscoveryService struct { prefix string } -const swarm_prefix = "swarm" - func init() { discovery.Register("consul", &ConsulDiscoveryService{}) } @@ -39,7 +37,7 @@ func (s *ConsulDiscoveryService) Initialize(uris string, heartbeat int) error { } s.client = client s.heartbeat = uint64(heartbeat) - s.prefix = swarm_prefix + "/" + path + "/" + s.prefix = path + "/" kv := s.client.KV() p := &consul.KVPair{Key: s.prefix, Value: nil} _, err = kv.Put(p, nil) diff --git a/discovery/consul/consul_test.go b/discovery/consul/consul_test.go index d154b8f87c..79bf873bdf 100644 --- a/discovery/consul/consul_test.go +++ b/discovery/consul/consul_test.go @@ -9,5 +9,5 @@ import ( func TestInitialize(t *testing.T) { discovery := &ConsulDiscoveryService{} discovery.Initialize("127.0.0.1:8500/path", 0) - assert.Equal(t, discovery.prefix, "swarm/path/") + assert.Equal(t, discovery.prefix, "path/") }