From 921e1b8962826caec2c1944ac313a5a138ec4fa4 Mon Sep 17 00:00:00 2001 From: Dimitrie Mititelu Date: Tue, 4 Jul 2017 17:45:44 +0300 Subject: [PATCH] Fix typo in exception name Changed exception name from MetadaNotFoundException to MetadataNotFoundException. Change-Id: I94be8c930ede4163a4f909452ccb530b14999a48 --- cloudbaseinit/exception.py | 2 +- cloudbaseinit/init.py | 2 +- cloudbaseinit/metadata/factory.py | 2 +- cloudbaseinit/metadata/services/azureservice.py | 4 ++-- cloudbaseinit/tests/metadata/services/test_azureservice.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cloudbaseinit/exception.py b/cloudbaseinit/exception.py index 6ac8b2c6..64b14283 100644 --- a/cloudbaseinit/exception.py +++ b/cloudbaseinit/exception.py @@ -34,7 +34,7 @@ class ServiceException(Exception): pass -class MetadaNotFoundException(CloudbaseInitException): +class MetadataNotFoundException(CloudbaseInitException): """Exception thrown in case no metadata service is found.""" diff --git a/cloudbaseinit/init.py b/cloudbaseinit/init.py index 428db5c3..d01e544c 100644 --- a/cloudbaseinit/init.py +++ b/cloudbaseinit/init.py @@ -188,7 +188,7 @@ class InitManager(object): if not (reboot_required and CONF.allow_reboot): try: service = metadata_factory.get_metadata_service() - except exception.MetadaNotFoundException: + except exception.MetadataNotFoundException: LOG.error("No metadata service found") if service: LOG.info('Metadata service loaded: \'%s\'' % diff --git a/cloudbaseinit/metadata/factory.py b/cloudbaseinit/metadata/factory.py index 7923b048..aa483274 100644 --- a/cloudbaseinit/metadata/factory.py +++ b/cloudbaseinit/metadata/factory.py @@ -34,4 +34,4 @@ def get_metadata_service(): except Exception as ex: LOG.error("Failed to load metadata service '%s'" % class_path) LOG.exception(ex) - raise exception.MetadaNotFoundException("No available service found") + raise exception.MetadataNotFoundException("No available service found") diff --git a/cloudbaseinit/metadata/services/azureservice.py b/cloudbaseinit/metadata/services/azureservice.py index 0df0f01d..bba6109a 100644 --- a/cloudbaseinit/metadata/services/azureservice.py +++ b/cloudbaseinit/metadata/services/azureservice.py @@ -75,7 +75,7 @@ class AzureService(base.BaseHTTPMetadataService): options = dhcp.get_dhcp_options() endpoint = (options or {}).get(WIRESERVER_DHCP_OPTION) if not endpoint: - raise exception.MetadaNotFoundException( + raise exception.MetadataNotFoundException( "Cannot find Azure WireServer endpoint address") return socket.inet_ntoa(endpoint) except Exception: @@ -88,7 +88,7 @@ class AzureService(base.BaseHTTPMetadataService): if "x-ms-version" not in self._headers: versions = self._get_versions() if WIRE_SERVER_VERSION not in versions.Versions.Supported.Version: - raise exception.MetadaNotFoundException( + raise exception.MetadataNotFoundException( "Unsupported Azure WireServer version: %s" % WIRE_SERVER_VERSION) self._headers["x-ms-version"] = WIRE_SERVER_VERSION diff --git a/cloudbaseinit/tests/metadata/services/test_azureservice.py b/cloudbaseinit/tests/metadata/services/test_azureservice.py index 57865196..bee21190 100644 --- a/cloudbaseinit/tests/metadata/services/test_azureservice.py +++ b/cloudbaseinit/tests/metadata/services/test_azureservice.py @@ -66,7 +66,7 @@ class AzureServiceTest(unittest.TestCase): dhcp_option=None): mock_dhcp.return_value = dhcp_option if not dhcp_option: - self.assertRaises(exception.MetadaNotFoundException, + self.assertRaises(exception.MetadataNotFoundException, (self._azureservice. _get_wire_server_endpoint_address)) else: @@ -409,7 +409,7 @@ class AzureServiceTest(unittest.TestCase): mock_get_versions.return_value = mock_version mock_version.Versions.Supported.Version = [version] if self._azureservice_module.WIRE_SERVER_VERSION is not version: - self.assertRaises(exception.MetadaNotFoundException, + self.assertRaises(exception.MetadataNotFoundException, self._azureservice._check_version_header) else: self._azureservice._check_version_header()