Commit Graph

4 Commits

Author SHA1 Message Date
Pedro Algarvio
916b6b402d
Skip tests if urllib3 is not installed 2016-03-16 19:40:48 +00:00
Steve Hajducko
a015473d4e Add etcd update function
Adds a update function that takes a dict and sets multiple etcd keys.
2016-01-25 14:13:33 -08:00
Steve Hajducko
cef6eff7c8 Catch ValueError on timeout on non-existing key
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.
2015-12-01 10:30:45 -08:00
Steve Hajducko
455f40b0d2 Refactor etcd modules
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.
2015-11-06 16:29:50 -08:00