Commit 9bd111f4 authored by Ayush Tiwari's avatar Ayush Tiwari

Hello World: Add jinja template

parent 65d12c03
......@@ -9,6 +9,7 @@ parts =
hello-world
hello-world-promise
publish-connection-parameter
render-template
# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
......@@ -59,6 +60,7 @@ service = $${:etc}/service
promise = $${:etc}/promise/
# Path of the log directory used by our service (see [hello-world])
log = $${:var}/log
data-fold = $${:home}/srv/data
# Create a simple web server that says "hello <configuration.name>" to the web.
......@@ -97,6 +99,15 @@ path = $${directory:promise}/hello-world
hostname= $${hello-world:ipv6}
port = $${hello-world:port}
[render-template]
recipe = slapos.recipe.template:jinja2
template = ${template-download:location}/${template-download:filename}
rendered = $${directory:data-fold}/data1.txt
#Why 700 specifically for rendered text file ??
mode = 700
context =
key name instance-parameter:configuration.name
key title instance-parameter:configuration.title
# Publish all the parameters needed for the user to connect to the instance.
# It can be anything: URL(s), password(s), or arbitrary parameters.
......@@ -107,3 +118,4 @@ name = Hello $${instance-parameter:configuration.name
# Publishing the title from configuration
title = $${instance-parameter:configuration.title}
url = $${hello-world:url}
path = $${render-template:rendered}
......@@ -34,6 +34,14 @@ output = ${buildout:directory}/instance.cfg
#md5sum = 968bea0fc81dc604a874c53648b7d13f
mode = 0644
# Dowloading helloweb service script in parts which would be later used in service
[template-download]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = rendered.in
download-only = True
mode = 0644
# install hello-web with correct python_executable
[hello-web-bin]
......
{% if title -%}
{{ title }}
{% endif -%}
Hello {{ name }}
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