Commit fff70ec9 authored by Lisa Casino's avatar Lisa Casino

html5as: update with the new recipe

See merge request !1020
parents d96b6895 e6668258
Pipeline #16681 failed with stage
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
[template-cfg] [template-cfg]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 8528c7b469caa8bdede682e6660ba702 md5sum = 9e486efe4ab1aba8cb72b04f6c6da8ad
[instance_html5as] [instance_html5as]
_update_hash_filename_ = instance_html5as.cfg.in _update_hash_filename_ = instance_html5as.cfg.in
md5sum = d1efe7a42d66c416ddf8d24d8a8107f4 md5sum = 191ec2a8b967a3944971709365bdcd2d
[template_nginx_conf] [template_nginx_conf]
_update_hash_filename_ = templates/nginx_conf.in _update_hash_filename_ = templates/nginx_conf.in
......
...@@ -9,8 +9,6 @@ offline = true ...@@ -9,8 +9,6 @@ offline = true
[profile-common] [profile-common]
nginx_location = {{ nginx_location }} nginx_location = {{ nginx_location }}
dash_location = {{ dash_location }} dash_location = {{ dash_location }}
tar_location = {{ tar_location }}
curl_location = {{ curl_location }}
template_nginx_conf = {{ template_nginx_conf_target }} template_nginx_conf = {{ template_nginx_conf_target }}
template_mime_types = {{ template_mime_types_target }} template_mime_types = {{ template_mime_types_target }}
template_launcher = {{ template_launcher_target }} template_launcher = {{ template_launcher_target }}
...@@ -28,6 +26,7 @@ context = ...@@ -28,6 +26,7 @@ context =
section parameter_list profile-common section parameter_list profile-common
# partition_ipv6 is the random ipv6 allocated to the local partition # partition_ipv6 is the random ipv6 allocated to the local partition
key partition_ipv6 slap-configuration:ipv6-random key partition_ipv6 slap-configuration:ipv6-random
# slapparameter_dict: dictionary of all parameters
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
jsonkey default_parameter_dict :default-parameters jsonkey default_parameter_dict :default-parameters
default-parameters = default-parameters =
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# Deploy html5as instance # Deploy html5as instance
# #
############################# #############################
# parameter_dict: a dictionary with the default parameters from instance.cfg.in
# replaces the values with the parameters of the instance request if there are any
{% set parameter_dict = dict(default_parameter_dict, **slapparameter_dict) %} {% set parameter_dict = dict(default_parameter_dict, **slapparameter_dict) %}
[buildout] [buildout]
...@@ -95,8 +97,6 @@ path_nginx_conf = ${directory:etc}/nginx.conf ...@@ -95,8 +97,6 @@ path_nginx_conf = ${directory:etc}/nginx.conf
path_mime_types = ${directory:etc}/mime_types path_mime_types = ${directory:etc}/mime_types
# Binaries # Binaries
path_shell = {{ parameter_list['dash_location'] }}/bin/dash path_shell = {{ parameter_list['dash_location'] }}/bin/dash
curl-binary = {{ parameter_list['curl_location'] }}/bin/curl
tar-binary = {{ parameter_list['tar_location'] }}/bin/tar
# Executables # Executables
bin_launcher = ${basedirectory:service}/launcher bin_launcher = ${basedirectory:service}/launcher
...@@ -131,13 +131,14 @@ context = ...@@ -131,13 +131,14 @@ context =
# Command to put content in the docroot # Command to put content in the docroot
[downloader] [downloader]
recipe = slapos.recipe.build recipe = slapos.recipe.build
# Path where the recipe stores any produced file, # Path where the recipe stores any produced file,
# it will be automatically removed at the beginning of "install". # it will be automatically removed at the beginning of "install".
location = ${directory:srv}/html5as location = ${directory:srv}/html5as
# All the keys in this section will be available as a dict called "self.options"
# We add: or '', otherwise jinja2 will render a 'None' string # We add: or '', otherwise jinja2 will render a 'None' string
url = {{ parameter_dict['download_url'] or '' }} url = {{ parameter_dict['download_url'] or '' }}
default_index_html = ${default_index_html:rendered} default_index_html = ${default_index_html:rendered}
# If a tarball is passed as a parameter in "download_url", # If a tarball is passed as a parameter in download url
# it's content will be served by the instance. # it's content will be served by the instance.
# If the parameter is not provided it fallback to the default template # If the parameter is not provided it fallback to the default template
install = install =
...@@ -146,10 +147,10 @@ install = ...@@ -146,10 +147,10 @@ install =
try: try:
# Allow to do self.download() which can only be used in "online" mode # Allow to do self.download() which can only be used in "online" mode
self.buildout['buildout']['offline'] = 'false' self.buildout['buildout']['offline'] = 'false'
if options['url']: if self.options['url']:
# Use fonctions from the slapos.recipe.build repository # Use fonctions from the slapos.recipe.build repository
# Download a file from a URL to a temporary path # Download a file from a URL to a temporary path
file = self.download(options['url'], options.get('md5sum')) file = self.download(self.options['url'])
# Create a directory and extract the file that are compressed inside # Create a directory and extract the file that are compressed inside
extract_dir = self.extract(file) extract_dir = self.extract(file)
# Return the right directory path # Return the right directory path
...@@ -159,7 +160,7 @@ install = ...@@ -159,7 +160,7 @@ install =
else: else:
# Create directory and copy the default template inside # Create directory and copy the default template inside
os.makedirs(location) os.makedirs(location)
shutil.copy(options['default_index_html'], location) shutil.copy(self.options['default_index_html'], location)
finally: finally:
# reset the parameter # reset the parameter
self.buildout['buildout']['offline'] = buildout_offline self.buildout['buildout']['offline'] = buildout_offline
......
...@@ -13,8 +13,6 @@ extends = ...@@ -13,8 +13,6 @@ extends =
# In this example we extend needed components for html5as. # In this example we extend needed components for html5as.
../../component/nginx/buildout.cfg ../../component/nginx/buildout.cfg
../../component/dash/buildout.cfg ../../component/dash/buildout.cfg
../../component/tar/buildout.cfg
../../component/curl/buildout.cfg
parts = parts =
# Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed # Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed
...@@ -36,8 +34,6 @@ context = ...@@ -36,8 +34,6 @@ context =
section buildout buildout section buildout buildout
key nginx_location nginx:location key nginx_location nginx:location
key dash_location dash:location key dash_location dash:location
key curl_location curl:location
key tar_location tar:location
key template_nginx_conf_target template_nginx_conf:target key template_nginx_conf_target template_nginx_conf:target
key template_mime_types_target template_mime_types:target key template_mime_types_target template_mime_types:target
key template_launcher_target template_launcher:target key template_launcher_target template_launcher:target
......
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