consul_api.kv.get() is supposed to return:
{
"CreateIndex": 100,
"ModifyIndex": 200,
"LockIndex": 200,
"Key": "foo",
"Flags": 0,
"Value": "bar",
"Session": "adf4238a-882b-9ddc-4a9d-5b6758e4159e"
}
It is true for Python 2.
When using Python 3, there is a minor difference for Value field:
which is bytes, not a string.
Thus, it makes Ansible consul_kv module, for example, not working properly as it badly compares string value coming from consul_api.kv.get():
>>> b'abc' == 'abc'
False
Suggestion: to return value as a string to make it working for Python 3 the same way as for 2.
>>> b'abc'.decode() == 'abc'
True
I am sure noone is going to put b'text' as a value into Consul KV as it will be stored exactly that way which seems to be a garbage.