Commit 52974930 authored by Jérome Perrin's avatar Jérome Perrin

Merge remote-tracking branch 'upstream/master' into zope4py2

parents 4f8f6c31 d8b06677
Pipeline #24068 failed with stage
in 0 seconds
......@@ -21,7 +21,7 @@ md5sum = 23c15a579b66cef866b30a2f53b1b737
[instance_html5as]
_update_hash_filename_ = instance_html5as.cfg.in
md5sum = 743f7ec8718de67f31720a68258a5ff2
md5sum = fc1dd9faf99a4f75e3727b80bb2d59fb
[template_nginx_conf]
_update_hash_filename_ = templates/nginx_conf.in
......
......@@ -90,7 +90,7 @@ path_access_log = ${basedirectory:log}/nginx.access.log
path_error_log = ${basedirectory:log}/nginx.error.log
path_tmp = ${tempdirectory:tmp}
# Docroot
docroot = ${downloader:location}
docroot = ${docroot:location}
default_index = ${:docroot}/index.html
# Config files
path_nginx_conf = ${directory:etc}/nginx.conf
......@@ -127,42 +127,39 @@ output = ${html5as:bin_launcher}
context =
section param_html5as html5as
# Command to put content in the docroot
# Command to download archive from provided url
[downloader]
recipe = slapos.recipe.build:download
# We add: or '', otherwise jinja2 will render a 'None' string
url = {{ parameter_dict['download_url'] or '' }}
# Allow to use slapos.recipe.build:download which can only be used in "online" mode
offline = false
# Command to put content in the docroot
[docroot]
recipe = slapos.recipe.build
# Path where the recipe stores any produced file,
# it will be automatically removed at the beginning of "install".
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
url = {{ parameter_dict['download_url'] or '' }}
archive = {{ '${downloader:destination}' if parameter_dict['download_url'] else '' }}
default_index_html = ${default_index_html:output}
# If a tarball is passed as a parameter in download url
# it's content will be served by the instance.
# If the parameter is not provided it fallback to the default template
install =
import os, shutil
buildout_offline = self.buildout['buildout']['offline']
try:
# Allow to do self.download() which can only be used in "online" mode
self.buildout['buildout']['offline'] = 'false'
if self.options['url']:
# Use fonctions from the slapos.recipe.build repository
# Download a file from a URL to a temporary path
file = self.download(self.options['url'])
# Create a directory and extract the file that are compressed inside
extract_dir = self.extract(file)
# Return the right directory path
workdir = guessworkdir(extract_dir)
# Recursively copy directory
self.copyTree(workdir, location)
else:
# Create directory and copy the default template inside
os.makedirs(location)
shutil.copy(self.options['default_index_html'], location)
finally:
# reset the parameter
self.buildout['buildout']['offline'] = buildout_offline
if self.options['archive']:
# Create a directory and extract the file that are compressed inside
extract_dir = self.extract(self.options['archive'])
# Return the right directory path
workdir = guessworkdir(extract_dir)
# Recursively copy directory
self.copyTree(workdir, location)
else:
# Create directory and copy the default template inside
os.makedirs(location)
shutil.copy(self.options['default_index_html'], location)
[default_index_html]
recipe = slapos.recipe.template:jinja2
......
......@@ -195,7 +195,7 @@ setuptools-dso = 1.7
rubygemsrecipe = 0.4.3
six = 1.16.0
slapos.cookbook = 1.0.272
slapos.core = 1.8.1
slapos.core = 1.8.2
slapos.extension.shared = 1.0
slapos.libnetworkcache = 0.25
slapos.rebootstrap = 4.5
......
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