Commit 0680119c authored by Jérome Perrin's avatar Jérome Perrin

support old options of slapos.recipe.template

parent 9cbc4621
......@@ -172,18 +172,27 @@ def bom_software(installed_software_path): # -> {} (name,kind) -> PkgInfo
elif recipe.startswith('slapos.recipe.template') or \
recipe == 'collective.recipe.template':
url = geturl(part, None)
if url is not None:
if isconf(url):
continue
# NOTE binary is not expected with slapos.recipe.template
raise ValueError('%s uses %s with url that does not look like a .conf file: %s' % (s, recipe, url))
else:
# it is an inline= script
if url is None:
if recipe.startswith('slapos'):
assert 'inline' in part, part
# old slapos.recipe.template option
url = part.get('template', raw=True)
if url is None:
# it is an inline= script
if 'inline' in part:
continue
# old versions of slapos.recipe.template did not save the url in options
if 'slapos.recipe.template-4' in part.get('__buildout_signature__', raw=True, fallback=''):
continue
raise ValueError('No url for %s' % part)
if url.startswith('inline:'):
continue
else: # collective...
assert part['input'].startswith('inline:')
if url is None or isconf(url):
continue
# NOTE binary is not expected with slapos.recipe.template
raise ValueError('%s uses %s with url that does not look like a .conf file: %s' % (s, recipe, url))
elif recipe in ('zc.recipe.egg:custom', 'zc.recipe.egg:develop'):
eggpath = part['__buildout_installed__']
......
......@@ -273,6 +273,36 @@ recipe = collective.recipe.template
input = inline: zzz
""", '') # inline ignore
# legacy options (template & rendered) for slapos.recipe.template
case1("""\
[matplotlibrc]
recipe = slapos.recipe.template:jinja2
rendered = /ROOT/parts/matplotlibrc/matplotlibrc
template = https://lab.nexedi.com/nexedi/slapos/raw/1.0.167.10/component/matplotlib/matplotlibrc.in
""", '')
case1("""\
[randomsleep]
recipe = slapos.recipe.template:jinja2
template = inline:x
""", '')
case1("""\
[randomsleep]
recipe = slapos.recipe.template
template = inline:x
""", '')
# slapos.recipe.template < 5 removed url from options
case1("""\
[template-fonts-conf]
recipe = slapos.recipe.template
__buildout_signature__ = Jinja2-2.9.5 MarkupSafe-1.0 setuptools-44.0.0 six-1.12.0 slapos.recipe.template-4.4 zc.buildout-2.7.1+slapos009 gcc:f7deef0474b0074beef57c09c3a00152
filename = fonts.conf.in
md5sum = 6967e553630d107fc0a59b14de8b0251
mode = 640
output = /srv/slapgrid/slappart15/srv/runner/instance/slappart7/tmp/soft/401a9f2389413c4c542be71a6c8a3a39/parts/template-fonts-conf
""", '')
case1("""\
[neoppod-develop]
......
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