diff --git a/krest.py b/krest.py index dc34e7e..e351f49 100644 --- a/krest.py +++ b/krest.py @@ -8,7 +8,7 @@ from __future__ import absolute_import -__version__ = "1.2.3" +__version__ = "1.2.4" import json import urlparse @@ -18,7 +18,7 @@ import traceback import requests -from requests.exceptions import ConnectionError, HTTPError +from requests.exceptions import ConnectionError, HTTPError, Timeout import time @@ -90,8 +90,8 @@ def wrapped(self, *args, **kwargs): retry = False try: return func(self, *args, **kwargs) - except ConnectionError, err: - logger.error("Connection Error: %s", str(err)) + except (ConnectionError, Timeout) as err: + logger.error("Connection/Timeout Error: %s", str(err)) if self.retry_cfg.on_connect_errors: retry = True except HTTPError, err: @@ -553,4 +553,4 @@ def __iter__(self): yield item def __len__(self): - return len(self._items) \ No newline at end of file + return len(self._items) diff --git a/krest.spec b/krest.spec index 1d870d4..928639c 100644 --- a/krest.spec +++ b/krest.spec @@ -1,7 +1,7 @@ %global pypi_name krest Name: python-%{pypi_name} -Version: 1.2.3 +Version: 1.2.4 Release: 1%{?dist} Summary: Python client for Kaminario K2 REST interface diff --git a/setup.py b/setup.py index d8672c9..bc077e4 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ """ setup(name="krest", - version="1.2.3", + version="1.2.4", py_modules=["krest"], install_requires=["requests >= 2.0.0"], maintainer="Zaar Hai", diff --git a/tests.py b/tests.py index f93f38c..d92c306 100644 --- a/tests.py +++ b/tests.py @@ -330,7 +330,7 @@ def _test_list(self, rest_objects=True): vols_single = [] if rest_objects: - vgs = self.ep.search("volume_groups") + vgs = self.ep.search("volume_groups", __limit=2) for vg in vgs: vols_single.extend(self.ep.search("volumes", volume_group=vg).hits) vols_multi = self.ep.search("volumes", volume_group=vgs).hits @@ -338,7 +338,7 @@ def _test_list(self, rest_objects=True): vols = self.ep.search("volumes", __limit=2) for v in vols: vols_single.extend(self.ep.search("volumes", name=v.name).hits) - vols_multi = self.ep.search("volumes", name=[vg.name for vg in vols]).hits + vols_multi = self.ep.search("volumes", name=[v.name for v in vols]).hits self.assertEqual(len(vols_multi), len(vols_single), msg="Single and multi queries returned different amount of results")