Commit f4996619 authored by Yusei Tahara's avatar Yusei Tahara

slapos/recipe/librecipe/generic.py: GenericBaseRecipe's _ws is a lazy attribute now.

getWorkingSet() is slow and it is not always needed. So, it is better not to call it in __init__.
parent 6d662699
......@@ -61,7 +61,13 @@ class GenericBaseRecipe(object):
self._options(options) # Options Hook
self.options = options.copy() # Updated options dict
self._ws = self.getWorkingSet()
@property
def _ws(self):
# getWorkingSet() is slow and it is not always needed.
# So _ws should be a lazy attribute.
if getattr(self, '_ws_internal', None) is None:
self._ws_internal = self.getWorkingSet()
return self._ws_internal
def update(self):
"""By default update method does the same thing than install"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment