salt/master.py:
- If ZMQ is not importable, use `tornado.ioloop.IOLoop` as the loop class.
- Check HAS_ZMQ before using any zmq.* content.
- Did not touch `FloMWorker` usage of zmq.*. This is only used when the
transport is RAET.
salt/minion.py:
- If ZMQ is not importable, use `tornado.ioloop.IOLoop` as the loop class.
- Check HAS_ZMQ before using any zmq.* content.
salt/transport/ipc.py:
- Added `IPCMessagePublisher`. This is intended to function much like
ZMQ's zmq.PUB sockets. Used in implementing utils/event.py to function
without ZMQ.
- Added `IPCMessageSubscriber`. This is intended to function much like
ZMQ's zmq.SUB sockets. Used in implementing utils/event.py to function
without ZMQ. What makes this class a bit different is that the associated
IO Loop is meant to not be running when it is used. Due to this, it is
recommended that the caller create a new IO Loop for this purpose. The
reason for this is that the `get_event()` API may be invoked from
anywhere, whether or not there is a current IO Loop that is running in
the thread of the invocation.
salt/utils/async.py:
- If ZMQ is not importable, use `tornado.ioloop.IOLoop` as the loop class.
salt/utils/event.py:
- Implemented using `salt.transport.ipc` instead of ZMQ.
- zmq.PUB ==> `IPCMessagePublisher`
- zmq.SUB ==> `IPCMessageSubscriber`
- zmq.PUSH ==> `IPCMessageClient`
- zmq.PULL ==> `IPCMessageServer`
Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
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.