diff options
| author | Abe Music <abe.music@gmail.com> | 2016-07-28 16:31:16 -0500 |
|---|---|---|
| committer | Abe Music <abe.music@gmail.com> | 2016-08-15 08:17:13 -0500 |
| commit | 29fcb04cf38de41276b2b23e69e86d898efe5afb (patch) | |
| tree | e97756d5165a4e879ea095000bec15066452e1bb /kolla/image | |
| parent | 6ea99983fcaf13f90efff1c20a3aa20db0af92ba (diff) | |
| download | kolla-29fcb04cf38de41276b2b23e69e86d898efe5afb.tar.gz kolla-29fcb04cf38de41276b2b23e69e86d898efe5afb.zip | |
enhancements to install_packages macro
- Adds debian_package_install method to the jinja environment
that will return the necessary set of commands needed to
install packages via apt-get and/or URLs to .deb packages
- Updates install_packages macro to make use of the method
above
Change-Id: Ie9318a7def54b5034ba91375fd8fd3b589d18349
Partially-implements: blueprint third-party-plugin-support
Diffstat (limited to 'kolla/image')
| -rw-r--r-- | kolla/image/build.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py index 090b28f4b..20d26e01b 100644 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -51,6 +51,7 @@ if PROJECT_ROOT not in sys.path: from kolla.common import config as common_config from kolla.common import task from kolla.template import filters as jinja_filters +from kolla.template import methods as jinja_methods from kolla import version @@ -625,6 +626,17 @@ class KollaWorker(object): } return filters + def _get_methods(self): + """Mapping of available Jinja methods + + return a dictionary that maps available function names and their + corresponding python methods to make them available in jinja templates + """ + + return { + 'debian_package_install': jinja_methods.debian_package_install, + } + def create_dockerfiles(self): kolla_version = version.version_info.cached_version_string() supported_distro_release = common_config.DISTRO_RELEASE.get( @@ -648,6 +660,7 @@ class KollaWorker(object): env = jinja2.Environment( # nosec: not used to render HTML loader=jinja2.FileSystemLoader(self.working_dir)) env.filters.update(self._get_filters()) + env.globals.update(self._get_methods()) tpl_path = os.path.join( os.path.relpath(path, self.working_dir), template_name) |
