diff --git a/Gemfile.lock b/Gemfile.lock index a29a29eb..40784ea9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - nerve (0.8.0) + nerve (0.8.1) bunny (= 1.1.0) etcd (~> 0.2.3) json diff --git a/lib/nerve/reporter/zookeeper.rb b/lib/nerve/reporter/zookeeper.rb index c2da84ec..a0225009 100644 --- a/lib/nerve/reporter/zookeeper.rb +++ b/lib/nerve/reporter/zookeeper.rb @@ -83,7 +83,8 @@ def zk_delete end def zk_create - @zk.mkdir_p(@zk_path) + # only mkdir_p if the path does not exist + @zk.mkdir_p(@zk_path) unless @zk.exists?(@zk_path) @full_key = @zk.create(@key_prefix, :data => @data, :mode => :ephemeral_sequential) end diff --git a/lib/nerve/version.rb b/lib/nerve/version.rb index fbd45748..c1ee7aed 100644 --- a/lib/nerve/version.rb +++ b/lib/nerve/version.rb @@ -1,3 +1,3 @@ module Nerve - VERSION = "0.8.0" + VERSION = "0.8.1" end diff --git a/spec/lib/nerve/reporter_zookeeper_spec.rb b/spec/lib/nerve/reporter_zookeeper_spec.rb index 26a05bd4..2c71fdfc 100644 --- a/spec/lib/nerve/reporter_zookeeper_spec.rb +++ b/spec/lib/nerve/reporter_zookeeper_spec.rb @@ -17,6 +17,7 @@ it 'deregisters service on exit' do zk = double("zk") allow(zk).to receive(:close!) + expect(zk).to receive(:exists?) { "zk_path" }.and_return(false) expect(zk).to receive(:mkdir_p) { "zk_path" } expect(zk).to receive(:create) { "full_path" } expect(zk).to receive(:delete).with("full_path", anything())