|
@@ -68,6 +68,7 @@ class MetaSettings(type):
|
68
|
68
|
# '.*')
|
69
|
69
|
# @todo delete the first stage, the lib path HAVE TO BE HARDCODED. In fact
|
70
|
70
|
#when we will run lodel in production the lodel2 lib will be in the python path
|
|
71
|
+#@todo add log messages (now we can)
|
71
|
72
|
class Settings(object, metaclass=MetaSettings):
|
72
|
73
|
|
73
|
74
|
## @brief Stores the singleton instance
|
|
@@ -85,6 +86,7 @@ class Settings(object, metaclass=MetaSettings):
|
85
|
86
|
## @brief Stores the configurations in namedtuple tree
|
86
|
87
|
self.__confs = None
|
87
|
88
|
self.__conf_dir = conf_dir
|
|
89
|
+ self.__started = False
|
88
|
90
|
self.__bootstrap()
|
89
|
91
|
|
90
|
92
|
## @brief Get the named tuple representing configuration
|
|
@@ -100,7 +102,7 @@ class Settings(object, metaclass=MetaSettings):
|
100
|
102
|
|
101
|
103
|
@classmethod
|
102
|
104
|
def started(cls):
|
103
|
|
- return cls.instance is not None and cls.instance.__confs is not None
|
|
105
|
+ return cls.instance is not None and cls.instance.__started
|
104
|
106
|
|
105
|
107
|
##@brief An utility method that raises if the singleton is not in a good
|
106
|
108
|
# state
|
|
@@ -128,6 +130,7 @@ class Settings(object, metaclass=MetaSettings):
|
128
|
130
|
|
129
|
131
|
##@brief This method handlers Settings instance bootstraping
|
130
|
132
|
def __bootstrap(self):
|
|
133
|
+ logger.debug("Settings bootstraping")
|
131
|
134
|
lodel2_specs = LODEL2_CONF_SPECS
|
132
|
135
|
for section in lodel2_specs:
|
133
|
136
|
if section.lower() != section:
|
|
@@ -154,6 +157,7 @@ class Settings(object, metaclass=MetaSettings):
|
154
|
157
|
plugins_path_opt_specs[0],
|
155
|
158
|
False)
|
156
|
159
|
# Starting the Plugins class
|
|
160
|
+ logger.debug("Starting lodel.plugin.Plugin class")
|
157
|
161
|
Plugin.start(plugins_path, plugins_list)
|
158
|
162
|
# Fetching conf specs from plugins
|
159
|
163
|
specs = [lodel2_specs]
|
|
@@ -167,6 +171,7 @@ class Settings(object, metaclass=MetaSettings):
|
167
|
171
|
raise SettingsErrors(errors)
|
168
|
172
|
self.__conf_specs = self.__merge_specs(specs)
|
169
|
173
|
self.__populate_from_specs(self.__conf_specs, loader)
|
|
174
|
+ self.__started = True
|
170
|
175
|
|
171
|
176
|
##@brief Produce a configuration specification dict by merging all specifications
|
172
|
177
|
#
|