The etcd watch function tries to read a key when it reaches the timeout
in order to obtain details about the key.
On python 2.6, when it tries to re-read the key, it throws a ValueError,
since python-etcd doesn't officially support python 2.6. The watch
function wasn't catching this ValueError, so it was returning the
exception, rather than a blank dict.
The etcd modules were using bits and pieces of python-etcd directly and
were using outdated exceptions to catch errors. These errors were
causing issues when trying to use etcd modules for logic.
A summary of changes
- Most of the 'work' is now done in etcd_util
- Removed import of python-etcd from states/etcd_mod and the
returner
- Added new tests for etcd_util
- Put in proper exceptions and catches for python-etcd
- Added support for ValueError catching. python-etcd doesn't
support python 2.6 and raises ValueError when trying to format
exceptions
- Added watch function to etcd execution module
- Added autospec to unit tests so hopefully less brittle
- Added TTL and directory features to the set function
*BACKWARDS INCOMPATIBLE CHANGES*
All interfaces are still backwards incompatible. However, the returns
from several of the etcd util functions have been changed. The old
returns presented issues with certain test cases. For instance, a
failed 'get' returned '', but a key with no value will also return ''.
The same issues occured with the 'ls', 'tree' and 'set' functions. Trying to
ls a blank directory returned the same result as a failed ls of a
non-existent key.
There was a problem wherein two sockets would race to see which was connected first,
causing unit.utils.event_test.TestSaltEvent.test_event_multiple_clients to fail from
time to time. This gives a little breathing room to the second socket.
This also only does the pub connect if necessary on SaltEvent instantation.
Add new option for top_file_merging_strategy to config
Add master config file option
Adding additional tests
Lexicographical test works
Make default strategy
Simplify to just an option about whether or not to merge
Changes
Implement ordered top files
Implement merge strategies and default top files
Lint
Doc rewrite and start on ordering
Remove debugging
Moving to env_order
Adding env_order
Still writing tests
More tests and docs
Add new option for top_file_merging_strategy to config
Add master config file option
Adding additional tests
Lexicographical test works
Make default strategy
Simplify to just an option about whether or not to merge
Changes
Implement ordered top files
Implement merge strategies and default top files
Lint
Doc rewrite and start on ordering
Remove debugging
Moving to env_order
Adding env_order
Still writing tests
More tests and docs
Require all multitasking contexts to subscribe to their events so one call to get_event for one tag does not discard events that should be saved for a subsequent call to get_event with another tag.
Use blocking get_event in batching with very small timeout.
Fixes#25998
Once subscribed to publisher SUB socket gets collecting all incoming
messages that is unwanted behavior for fire-only events.
Fixed by using listen=<True|False> constructor argument.
While thinking through issues that might cause #25718 I ran into this case-- where you can create 2 sync wrappers with the same parent IOLoop and run into problems because you can't start/stop the loop multiple times like that and have the call tree work correctly. To solve this (since it *should* be the exceptional case) I'm making SyncWrapper keep track of which loops are in use-- then if someone attempts this situation it will simply make another one.