WIP: Expand the developer documentation #27
7 changed files with 95 additions and 2 deletions
|
|
@ -408,7 +408,7 @@ class ParserVariable:
|
||||||
exists = obj.pop("exists", None)
|
exists = obj.pop("exists", None)
|
||||||
else:
|
else:
|
||||||
exists = None
|
exists = None
|
||||||
redefine = obj.pop("redefine", False) or force_redefine is True
|
redefine = obj.pop("redefine", False) or (force_redefine is True and path in self.paths)
|
||||||
obj_type = self.get_family_or_variable_type(obj)
|
obj_type = self.get_family_or_variable_type(obj)
|
||||||
force_to_attrs = list(self.list_attributes(obj, sources, obj_type))
|
force_to_attrs = list(self.list_attributes(obj, sources, obj_type))
|
||||||
for key, value in obj.items():
|
for key, value in obj.items():
|
||||||
|
|
@ -699,7 +699,7 @@ class ParserVariable:
|
||||||
self.parse_params(path, obj, sources)
|
self.parse_params(path, obj, sources)
|
||||||
self.parse_secret_manager(path, obj, sources, family_is_dynamic, copy_before_set)
|
self.parse_secret_manager(path, obj, sources, family_is_dynamic, copy_before_set)
|
||||||
exists = obj.pop("exists", None)
|
exists = obj.pop("exists", None)
|
||||||
redefine = obj.pop("redefine", False) or force_redefine is True
|
redefine = obj.pop("redefine", False) or (force_redefine is True and path in self.paths)
|
||||||
if not redefine and not exists:
|
if not redefine and not exists:
|
||||||
obj_type = obj.get("type")
|
obj_type = obj.get("type")
|
||||||
if obj_type in self.custom_variable_types:
|
if obj_type in self.custom_variable_types:
|
||||||
|
|
|
||||||
|
|
@ -81,3 +81,7 @@ def test_type_variable_hidden():
|
||||||
|
|
||||||
def test_type_dynfamily():
|
def test_type_dynfamily():
|
||||||
type_variable("family_dynfamily")
|
type_variable("family_dynfamily")
|
||||||
|
|
||||||
|
|
||||||
|
def test_type_family_subfamily_add():
|
||||||
|
type_variable("family_subfamily_add")
|
||||||
|
|
|
||||||
28
tests/types/result/family_subfamily_add/tiramisu.py
Normal file
28
tests/types/result/family_subfamily_add/tiramisu.py
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
from tiramisu import *
|
||||||
|
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||||
|
from re import compile as re_compile
|
||||||
|
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||||
|
try:
|
||||||
|
groups.namespace
|
||||||
|
except:
|
||||||
|
groups.addgroup('namespace')
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||||
|
option_3 = StrOption(name="a_first_variable", doc="a first variable", default="a modified value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml', 'tests/types/structures/family_subfamily_add/00_structure.yml'], 'type': 'string'})
|
||||||
|
option_5 = StrOption(name="a_second_variable", doc="a second variable", default="a modified value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml', 'tests/types/structures/family_subfamily_add/00_structure.yml'], 'type': 'string'})
|
||||||
|
optiondescription_4 = OptionDescription(name="a_sub_family", doc="My subfamily", children=[option_5], properties=frozenset({"standard"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml', 'tests/types/structures/family_subfamily_add/00_structure.yml']})
|
||||||
|
option_7 = StrOption(name="a_second_variable", doc="a_second_variable", default="a modified value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/structures/family_subfamily_add/00_structure.yml'], 'type': 'string'})
|
||||||
|
optiondescription_6 = OptionDescription(name="a_new_subfamily", doc="a_new_subfamily", children=[option_7], properties=frozenset({"standard"}), informations={'ymlfiles': ['tests/types/structures/family_subfamily_add/00_structure.yml']})
|
||||||
|
optiondescription_2 = OptionDescription(name="my_family_1", doc="My family type", children=[option_3, optiondescription_4, optiondescription_6], properties=frozenset({"standard"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml', 'tests/types/structures/family_subfamily_add/00_structure.yml']})
|
||||||
|
option_9 = StrOption(name="a_first_variable", doc="a first variable", default="a value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml'], 'type': 'string'})
|
||||||
|
option_11 = StrOption(name="a_second_variable", doc="a second variable", properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml'], 'type': 'string'})
|
||||||
|
optiondescription_10 = OptionDescription(name="a_sub_family", doc="My subfamily", children=[option_11], properties=frozenset({"basic"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml']})
|
||||||
|
optiondescription_8 = OptionDescription(name="my_family_2", doc="My family type", children=[option_9, optiondescription_10], properties=frozenset({"basic"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml', 'tests/types/structures/family_subfamily_add/00_structure.yml']})
|
||||||
|
option_13 = StrOption(name="a_first_variable", doc="a first variable", default="a value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml'], 'type': 'string'})
|
||||||
|
option_15 = StrOption(name="a_second_variable", doc="a second variable", default="a modified value 2", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml', 'tests/types/structures/family_subfamily_add/00_structure.yml'], 'type': 'string'})
|
||||||
|
optiondescription_14 = OptionDescription(name="a_sub_family", doc="My subfamily", children=[option_15], properties=frozenset({"standard"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml', 'tests/types/structures/family_subfamily_add/00_structure.yml']})
|
||||||
|
option_16 = StrOption(name="a_new_variable", doc="a_new_variable", default="a modified value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/structures/family_subfamily_add/00_structure.yml'], 'type': 'string'})
|
||||||
|
optiondescription_12 = OptionDescription(name="my_family_3", doc="My family type", children=[option_13, optiondescription_14, option_16], properties=frozenset({"standard"}), informations={'ymlfiles': ['tests/types/types/family_subfamily_add/00_structure.yml', 'tests/types/structures/family_subfamily_add/00_structure.yml']})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", group_type=groups.namespace, children=[optiondescription_2, optiondescription_8, optiondescription_12], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
10
tests/types/result/family_subfamily_add/variables.json
Normal file
10
tests/types/result/family_subfamily_add/variables.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.my_family_1.a_first_variable": "a modified value",
|
||||||
|
"rougail.my_family_1.a_sub_family.a_second_variable": "a modified value",
|
||||||
|
"rougail.my_family_1.a_new_subfamily.a_second_variable": "a modified value",
|
||||||
|
"rougail.my_family_2.a_first_variable": "a value",
|
||||||
|
"rougail.my_family_2.a_sub_family.a_second_variable": null,
|
||||||
|
"rougail.my_family_3.a_first_variable": "a value",
|
||||||
|
"rougail.my_family_3.a_sub_family.a_second_variable": "a modified value 2",
|
||||||
|
"rougail.my_family_3.a_new_variable": "a modified value"
|
||||||
|
}
|
||||||
10
tests/types/result/family_subfamily_add/variables_rw.json
Normal file
10
tests/types/result/family_subfamily_add/variables_rw.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.my_family_1.a_first_variable": "a modified value",
|
||||||
|
"rougail.my_family_1.a_sub_family.a_second_variable": "a modified value",
|
||||||
|
"rougail.my_family_1.a_new_subfamily.a_second_variable": "a modified value",
|
||||||
|
"rougail.my_family_2.a_first_variable": "a value",
|
||||||
|
"rougail.my_family_2.a_sub_family.a_second_variable": null,
|
||||||
|
"rougail.my_family_3.a_first_variable": "a value",
|
||||||
|
"rougail.my_family_3.a_sub_family.a_second_variable": "a modified value 2",
|
||||||
|
"rougail.my_family_3.a_new_variable": "a modified value"
|
||||||
|
}
|
||||||
29
tests/types/structures/family_subfamily_add/00_structure.yml
Normal file
29
tests/types/structures/family_subfamily_add/00_structure.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
my_family_1:
|
||||||
|
type: my_family_type
|
||||||
|
|
||||||
|
a_first_variable: a modified value
|
||||||
|
|
||||||
|
a_sub_family:
|
||||||
|
|
||||||
|
a_second_variable: a modified value
|
||||||
|
|
||||||
|
a_new_subfamily:
|
||||||
|
|
||||||
|
a_second_variable: a modified value
|
||||||
|
|
||||||
|
my_family_2:
|
||||||
|
type: my_family_type
|
||||||
|
|
||||||
|
my_family_3:
|
||||||
|
type: my_family_type
|
||||||
|
|
||||||
|
a_new_variable: a modified value
|
||||||
|
|
||||||
|
a_sub_family:
|
||||||
|
|
||||||
|
a_second_variable: a modified value 2
|
||||||
|
...
|
||||||
12
tests/types/types/family_subfamily_add/00_structure.yml
Normal file
12
tests/types/types/family_subfamily_add/00_structure.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
my_family_type: # My family type
|
||||||
|
|
||||||
|
a_first_variable: a value # a first variable
|
||||||
|
|
||||||
|
a_sub_family: # My subfamily
|
||||||
|
|
||||||
|
a_second_variable: # a second variable
|
||||||
|
...
|
||||||
Loading…
Reference in a new issue