-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUGFIX: pass metadata to locking APIs #138
BUGFIX: pass metadata to locking APIs #138
Conversation
Codecov Report
@@ Coverage Diff @@
## master #138 +/- ##
==========================================
+ Coverage 99.19% 99.20% +0.01%
==========================================
Files 39 40 +1
Lines 2115 2149 +34
==========================================
+ Hits 2098 2132 +34
Misses 17 17
Continue to review full report at Codecov.
|
Hey, thanks for this! I'm not sure what version you're running, but there was a known bug in Etcd that would invalidate basic auth tokens when the auth revision changed. JWT tokens were also broken last time I checked. 🙄 |
interesting. I've been testing against a brand new |
here's a code snippet: #!/usr/bin/env ruby
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
# gem 'etcdv3', '0.11.4',
gem 'etcdv3', git: 'https://github.com/forestgagnon/etcdv3-ruby', branch: 'fix-authenticated-locks'
end
require 'etcdv3'
client = Etcdv3.new(endpoints: 'http://127.0.0.1:2379', user: 'root', password: ENV.fetch("ETCD_ROOT_PASSWORD"))
begin
lease_id = client.lease_grant(20)['ID']
lock_key = client.lock('some-lock', lease_id, timeout: 10).key
puts lock_key
sleep 2
puts "do thing 1"
sleep 5
puts "do thing 2"
ensure
client.unlock(lock_key, timeout: 10)
end 0.11.4 succeeds up to |
Thanks again. Just cut a new release with your changes. |
appreciate the quick release! |
I am trying to use this gem against an etcd deployment protected by username/password authentication. Some operations work fine, but there is a bug in the locking methods that causes a mysterious "user name is empty" error, even though the client instance is configured with a username and password and works for other operations like
get
orlease_grant
.After some digging I noticed that for the locking APIs, there is a metadata object which is not being passed through by the wrappers to the protobuf functions. This object is passed though by the other wrappers I looked at, so it appeared to be an oversight specific to the addition of the locking API.
This change fixes the bugs I ran into and adds some regression tests for them.