Updated the Openstack-Aodh-plugin
[osm/MON.git] / plugins / OpenStack / settings.py
index 4dacef9..fc54b07 100644 (file)
@@ -2,27 +2,30 @@
 
 from __future__ import unicode_literals
 
-from plugins.Openstack.singleton import Singleton
+import logging as log
+import os
 
 from collections import namedtuple
+
+from plugins.Openstack.singleton import Singleton
+
 import six
-import os
 
 
 class BadConfigError(Exception):
-    """Configuration exception"""
+    """Configuration exception."""
+
     pass
 
 
 class CfgParam(namedtuple('CfgParam', ['key', 'default', 'data_type'])):
-    """Configuration parameter definition"""
+    """Configuration parameter definition."""
 
     def value(self, data):
-        """Convert a string to the parameter type"""
-
+        """Convert a string to the parameter type."""
         try:
             return self.data_type(data)
-        except (ValueError, TypeError) as exc:
+        except (ValueError, TypeError):
             raise BadConfigError(
                 'Invalid value "%s" for configuration parameter "%s"' % (
                     data, self.key))
@@ -30,7 +33,7 @@ class CfgParam(namedtuple('CfgParam', ['key', 'default', 'data_type'])):
 
 @Singleton
 class Config(object):
-    """Plugin confguration"""
+    """Plugin confguration."""
 
     _configuration = [
         CfgParam('OS_AUTH_URL', None, six.text_type),
@@ -44,13 +47,12 @@ class Config(object):
     _config_keys = _config_dict.keys()
 
     def __init__(self):
-        """Set the default values"""
+        """Set the default values."""
         for cfg in self._configuration:
             setattr(self, cfg.key, cfg.default)
 
     def read_environ(self):
         """Check the appropriate environment variables and update defaults."""
-
         for key in self._config_keys:
             if (key == "OS_IDENTITY_API_VERSION" or key == "OS_PASSWORD"):
                 val = str(os.environ[key])
@@ -59,5 +61,6 @@ class Config(object):
                 val = str(os.environ[key]) + "/v3"
                 setattr(self, key, val)
             else:
-                # TODO: Log errors and no config updates required
+                # TODO(mcgoughh): Log errors and no config updates required
+                log.warn("Configuration doesn't require updating")
                 return