1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

made loading of galaxy data files lazy

This commit is contained in:
Brian Coca 2016-01-12 12:24:46 -05:00
parent cf9dfde15b
commit 06fa841516

View file

@ -49,11 +49,34 @@ class Galaxy(object):
this_dir, this_filename = os.path.split(__file__) this_dir, this_filename = os.path.split(__file__)
self.DATA_PATH = os.path.join(this_dir, "data") self.DATA_PATH = os.path.join(this_dir, "data")
#TODO: move to getter for lazy loading self._default_readme = None
self.default_readme = self._str_from_data_file('readme') self._default_meta = None
self.default_meta = self._str_from_data_file('metadata_template.j2') self._default_test = None
self.default_test = self._str_from_data_file('test_playbook.j2') self._default_travis = None
self.default_travis = self._str_from_data_file('travis.j2')
@property
def default_readme(self):
if self._default_readme is None:
self._default_readme = self._str_from_data_file('readme')
return self._default_readme
@property
def default_meta(self):
if self._default_meta is None:
self._default_meta = self._str_from_data_file('metadata_template.j2')
return self._default_meta
@property
def default_test(self):
if self._default_test is None:
self._default_test = self._str_from_data_file('test_playbook.j2')
return self._default_test
@property
def default_travis(self):
if self._default_travis is None:
self._default_travis = self._str_from_data_file('travis.j2')
return self._default_travis
def add_role(self, role): def add_role(self, role):
self.roles[role.name] = role self.roles[role.name] = role