Closed kinvaris closed 7 years ago
@kinvaris , if you need this can you create a PR which removed the trailing slash
I believe the trick is to replace in https://github.com/openvstorage/framework/blob/d5086cf0fd9c36e0708f45ffacd559549dd407b4/ovs/extensions/generic/configuration.py#L215
return Configuration._list(key)
with
return Configuration._list(key.rstrip("/"))
We might want to the same for dir_exists(key):
Note, might be that ETCD gives a different output compared to Arakoon.
Might have impact on Configuration.list('/') we sometimes use.
Also check if input validation is done on the key.
@wimpers : Perhaps QA should do their job and framework should do their job too ;) Framework: Fix bugs rapported by QA (thus opening PRs) QA: Find bugs introduced by Framework
@kvanhijf A feel a lot of job protection there? A great 'Make engineering great again'-feeling :p
@kinvaris which config mgmt tool is this Arakoon/ETCD or is this happening on both?
@wimpers : Not so much really
@wimpers, @kinvaris, @kvanhijf; A lot of these things were implemented to keep the exact same behavior as with Etcd which means that you could not do a list on /ovs/arakoon/
as far as I know. An rstrip could resolve this for the arakoon implementation but might introduce issues in the etcd implementation. There's already a ton of awkward code in the configuration wrapper to keep the two compatible (behave identically)
To be honest, I'd rather just remove Etcd support altogether and make a lot of changes next to this one to make our config management at least a bit more straightforward to use, as this keep-things-compatible-with-etcd is just a pain in the ass.
Fixed by #1031, packaged in openvstorage-2.7.4-rev.4136.8d34d87
Seeing as the 'fix' both mentions the starting and trailing '/', I will test both for both cases. The fix is only applied to ArakoonConfiguration, no changes have been made to EtcdConfiguration.
from ovs.extensions.generic.configuration import Configuration
# Seeing as it would be the same call, the order should also be identical
normal_case = []
starting_case = []
trailing_case = []
starting_trailing_case = []
for i in Configuration.list('ovs/arakoon'):
normal_case.append(i)
for i in Configuration.list('/ovs/arakoon'):
starting_case.append(i)
for i in Configuration.list('ovs/arakoon'):
trailing_case.append(i)
for i in Configuration.list('/ovs/arakoon/'):
starting_trailing_case.append(i)
for index, value in enumerate(normal_case):
if (starting_case[index] and trailing_case[index] and starting_trailing_case[index]) == value:
print 'All lists match for {0} on position {1}'.format(value, index)
else:
raise ValueError('The test has failed, difference in return values')
All lists match for gwgw-abm on position 0
All lists match for gwgw-nsm_0 on position 1
All lists match for gwgwgwg-abm on position 2
All lists match for gwgwgwg-nsm_0 on position 3
All lists match for gwwwg-abm on position 4
All lists match for gwwwg-nsm_0 on position 5
All lists match for hehehe-abm on position 6
All lists match for hehehe-nsm_0 on position 7
All lists match for mybackend-abm on position 8
All lists match for mybackend-nsm_0 on position 9
All lists match for ovsdb on position 10
All lists match for test-abm on position 11
All lists match for test-nsm_0 on position 12
All lists match for voldrv on position 13
Test passed.
As seen in example: