Commit 7338e460 authored by Vincent Pelletier's avatar Vincent Pelletier

Expose software type separately from partition parameters.

Also, hide ip_list for the same reason: it's a partition property, not a
partition parameter. It is not handled yet (not needed).
Also, rework documentation a bit.
parent bb5380ee
...@@ -65,14 +65,18 @@ class Recipe(object): ...@@ -65,14 +65,18 @@ class Recipe(object):
integer value to enable them. integer value to enable them.
Output: Output:
One key per supported serialisation format, with all partition parameters slap-software-type.<format>
serialised in that format as values and format's name. Current partition's software type, serialised in each available format.
Also, one key per partition parameter, prefixed with serialisation format <format>
followed by a dot. Example: All partition parameters serialised in that format as values.
Example:
json = {"foo": "bar"} json = {"foo": "bar"}
<format>.key
One key per partition parameter, prefixed with serialisation format
followed by a dot. Example:
json.foo = "bar" json.foo = "bar"
Supported serailisation formats: Supported serialisation formats:
json (safe) json (safe)
JavaScript Object Notation JavaScript Object Notation
str (unsafe) str (unsafe)
...@@ -94,11 +98,16 @@ class Recipe(object): ...@@ -94,11 +98,16 @@ class Recipe(object):
options['computer'], options['computer'],
options['partition'], options['partition'],
).getInstanceParameterDict() ).getInstanceParameterDict()
# XXX: those are not partition parameters, strictly speaking.
# Discard them, and make them available as separate section keys.
slap_software_type = parameter_dict.pop('slap_software_type')
del parameter_dict['ip_list']
allow_unsafe = bool(int(options.get('unsafe', '0'))) allow_unsafe = bool(int(options.get('unsafe', '0')))
match = self.OPTCRE.match match = self.OPTCRE.match
for name, (safe, cast) in cast_dict.iteritems(): for name, (safe, cast) in cast_dict.iteritems():
if not safe and not allow_unsafe: if not safe and not allow_unsafe:
continue continue
options['slap-software-type.' + name] = cast(slap_software_type)
options[name] = cast(parameter_dict) options[name] = cast(parameter_dict)
for key, value in parameter_dict.iteritems(): for key, value in parameter_dict.iteritems():
if match(key) is not None: if match(key) is not None:
......
{% if software_type == slapparameter_dict['slap_software_type'] -%} {% if software_type == slap_software_type -%}
{% set json = json_module.loads(parameter_dict.get('cloudooo-json', '{}')) -%} {% set json = json_module.loads(parameter_dict.get('cloudooo-json', '{}')) -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%} {% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
[buildout] [buildout]
......
{% if software_type == slapparameter_dict['slap_software_type'] -%} {% if software_type == slap_software_type -%}
{# {#
Note: all port counters are pre-incremented. No idea why base port is skipped. Note: all port counters are pre-incremented. No idea why base port is skipped.
-#} -#}
......
...@@ -21,6 +21,7 @@ extra-context = ...@@ -21,6 +21,7 @@ extra-context =
context = context =
key eggs_directory buildout:eggs-directory key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory key develop_eggs_directory buildout:develop-eggs-directory
jsonkey slap_software_type slap-parameters:slap-software-type.json
jsonkey slapparameter_dict slap-parameters:json jsonkey slapparameter_dict slap-parameters:json
${:extra-context} ${:extra-context}
......
...@@ -132,13 +132,13 @@ extra-context = ...@@ -132,13 +132,13 @@ extra-context =
[template-tidstorage] [template-tidstorage]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-tidstorage.cfg.in url = ${:_profile_base_location_}/instance-tidstorage.cfg.in
md5sum = 34e7ba946640e5aec08d72634b25128f md5sum = eeea27e691d80c1dd605ad99cfbba3c3
mode = 640 mode = 640
[template-cloudooo] [template-cloudooo]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-cloudoo.cfg.in url = ${:_profile_base_location_}/instance-cloudoo.cfg.in
md5sum = aea927d5d3363177fd1017c4b89838d7 md5sum = d3b3afac9099823ba2853070324a29c8
mode = 640 mode = 640
# Additional Configuration # Additional Configuration
...@@ -149,7 +149,7 @@ configurator_bt5_list = erp5_core_proxy_field_legacy erp5_full_text_myisam_catal ...@@ -149,7 +149,7 @@ configurator_bt5_list = erp5_core_proxy_field_legacy erp5_full_text_myisam_catal
# XXX: "template.cfg" is hardcoded in instanciation recipe # XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in template = ${:_profile_base_location_}/instance.cfg.in
md5sum = fc4c561f56387b74b45664f0f2268725 md5sum = 0f3dcf0e156025d6b8f5f3efdd161282
extra-context = extra-context =
key apache_location apache:location key apache_location apache:location
key aspell_location aspell:location key aspell_location aspell:location
......
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