|
self.parent = parent |
|
self.workdir = parent.workdir |
|
self.sub_components = [] |
|
if self.parent is self.root: |
|
self._overrides(self.root.overrides) |
|
# Fix up attributes that have been set through the constructor. |
|
for k, v in list(self.__dict__.items()): |
|
attribute = getattr(self.__class__, k, None) |
|
if not isinstance(attribute, Attribute): |
|
continue |
|
# Setting it using the mutator causes conversions and our |
|
# special attribute handling to catch up. |
|
setattr(self, k, v) |
|
|
|
with self.chdir(self.defdir): |
|
self.configure() |
|
self += self._get_platform() |
|
self._platform_component = self._ |
|
self.__setup_event_handlers__() |
|
self._prepared = True |
If we try catch and rethrow errors in this function, we can enrich them with their tracebacks more meaningfully than having to throw a UnknownComponentConfigurationError as here
|
except Exception as e: |
|
# An unknown exception which we have to work harder |
|
# to report gracefully. |
|
ex_type, ex, tb = sys.exc_info() |
|
exceptions.append( |
|
UnknownComponentConfigurationError.from_context( |
|
root, e, tb |
|
) |
|
) |
Which says that this may indicate a bug in batou. But we don't want to have the message in a few cases (for example, user errors when using the templating mechanism (see #417)
batou/src/batou/component.py
Lines 232 to 251 in 10caa65
If we try catch and rethrow errors in this function, we can enrich them with their tracebacks more meaningfully than having to throw a UnknownComponentConfigurationError as here
batou/src/batou/environment.py
Lines 509 to 517 in 10caa65
Which says that this may indicate a bug in batou. But we don't want to have the message in a few cases (for example, user errors when using the templating mechanism (see #417)