diff --git a/cloudbridge/cloud/factory.py b/cloudbridge/cloud/factory.py index 34883dcd..4b60a079 100644 --- a/cloudbridge/cloud/factory.py +++ b/cloudbridge/cloud/factory.py @@ -68,14 +68,11 @@ def register_provider_class(self, cls): def discover_providers(self): """ Discover all available providers within the - cloudbridge.cloud.providers package. + ``cloudbridge.cloud.providers`` package. + Note that this methods does not guard against a failed import. """ for _, modname, _ in pkgutil.iter_modules(providers.__path__): - try: - self._import_provider(modname) - except: - log.exception("Could not import providers from module: %s", - modname) + self._import_provider(modname) def _import_provider(self, module_name): """ diff --git a/cloudbridge/cloud/providers/aws/provider.py b/cloudbridge/cloud/providers/aws/provider.py index ccb0a045..a959567e 100644 --- a/cloudbridge/cloud/providers/aws/provider.py +++ b/cloudbridge/cloud/providers/aws/provider.py @@ -6,9 +6,14 @@ import boto from boto.ec2.regioninfo import RegionInfo -from httpretty import HTTPretty -from moto.ec2 import mock_ec2 -from moto.s3 import mock_s3 +try: + # These are installed only for the case of a dev instance + from httpretty import HTTPretty + from moto.ec2 import mock_ec2 + from moto.s3 import mock_s3 +except ImportError: + # TODO: Once library logging is configured, change this + print("[aws provider] moto library not available!") from cloudbridge.cloud.base import BaseCloudProvider from cloudbridge.cloud.interfaces import TestMockHelperMixin