Reduce dependency to tempest: exceptions

In order to be independent from changes in Tempest Manila should
use the tempest_lib as much as possible. Exception classes are
already copied to tempest_lib.

Closes-Bug: #1489299

Change-Id: I043be143d7d35614af1f6d7892b0a0bc71d73580
This commit is contained in:
Marc Koderer 2015-08-04 10:56:28 +02:00
parent 9b77e13302
commit 922204cc8d
4 changed files with 26 additions and 28 deletions

View File

@ -17,18 +17,17 @@ import copy
import inspect
import traceback
from oslo_concurrency import lockutils # noqa
from oslo_log import log # noqa
import six # noqa
from tempest_lib.common.utils import data_utils # noqa
from tempest_lib import exceptions as lib_exc # noqa
from oslo_concurrency import lockutils
from oslo_log import log
import six
from tempest_lib.common.utils import data_utils
from tempest_lib import exceptions
from tempest import clients_share as clients
from tempest.common import isolated_creds
from tempest import config_share as config
from tempest import exceptions
from tempest import share_exceptions
from tempest import test
from tempest import clients_share as clients # noqa
from tempest.common import isolated_creds # noqa
from tempest import config_share as config # noqa
from tempest import share_exceptions # noqa
from tempest import test # noqa
CONF = config.CONF
LOG = log.getLogger(__name__)
@ -37,7 +36,7 @@ LOG = log.getLogger(__name__)
class handle_cleanup_exceptions(object):
"""Handle exceptions raised with cleanup operations.
Always suppress errors when lib_exc.NotFound or lib_exc.Forbidden
Always suppress errors when exceptions.NotFound or exceptions.Forbidden
are raised.
Suppress all other exceptions only in case config opt
'suppress_errors_in_cleanup' in config group 'share' is True.
@ -48,7 +47,7 @@ class handle_cleanup_exceptions(object):
def __exit__(self, exc_type, exc_value, exc_traceback):
if not (isinstance(exc_value,
(lib_exc.NotFound, lib_exc.Forbidden)) or
(exceptions.NotFound, exceptions.Forbidden)) or
CONF.share.suppress_errors_in_cleanup):
return False # Do not suppress error if any
if exc_traceback:

View File

@ -13,13 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging # noqa
from tempest_lib.common.utils import data_utils # noqa
from oslo_log import log as logging
from tempest_lib.common.utils import data_utils
from tempest_lib import exceptions
from tempest import config
from tempest import exceptions
from tempest.scenario import manager_share as manager
from tempest import test
from tempest import config # noqa
from tempest.scenario import manager_share as manager # noqa
from tempest import test # noqa
CONF = config.CONF

View File

@ -17,14 +17,13 @@ import json
import time
import urllib
import six # noqa
from tempest_lib.common import rest_client # noqa
from tempest_lib.common.utils import data_utils # noqa
from tempest_lib import exceptions as lib_exc # noqa
import six
from tempest_lib.common import rest_client
from tempest_lib.common.utils import data_utils
from tempest_lib import exceptions
from tempest import config_share as config
from tempest import exceptions
from tempest import share_exceptions
from tempest import config_share as config # noqa
from tempest import share_exceptions # noqa
CONF = config.CONF
@ -392,7 +391,7 @@ class SharesClient(rest_client.RestClient):
def _is_resource_deleted(self, func, res_id):
try:
res = func(res_id)
except lib_exc.NotFound:
except exceptions.NotFound:
return True
if res.get('status') == 'error_deleting':
# Resource has "error_deleting" status and can not be deleted.

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest import exceptions
from tempest_lib import exceptions
class ShareBuildErrorException(exceptions.TempestException):