Compare commits
No commits in common. "e7c157aa09473bc3456a80808f3e092c508a26fd" and "af473317c3a9f86f8dbb32a839f6f860d20ed5b3" have entirely different histories.
e7c157aa09
...
af473317c3
37 changed files with 40 additions and 370 deletions
BIN
src/rougail_tests/__pycache__/custom.cpython-313.pyc
Normal file
BIN
src/rougail_tests/__pycache__/custom.cpython-313.pyc
Normal file
Binary file not shown.
|
|
@ -1,4 +1,3 @@
|
||||||
from tiramisu import owners
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from rougail import RougailConfig
|
from rougail import RougailConfig
|
||||||
|
|
||||||
|
|
@ -13,55 +12,42 @@ def get_funcs():
|
||||||
return [str(test) for test in sorted((Path(__file__).parent.parent.parent / 'funcs').iterdir()) if test.name.endswith('.py')]
|
return [str(test) for test in sorted((Path(__file__).parent.parent.parent / 'funcs').iterdir()) if test.name.endswith('.py')]
|
||||||
|
|
||||||
|
|
||||||
def get_rougail_config(test_dir, namespace=False, relative_to=None):
|
def get_rougail_config(test_dir, namespace=False):
|
||||||
rougailconfig = RougailConfig
|
rougailconfig = RougailConfig
|
||||||
rougailconfig['functions_files'] = get_funcs()
|
rougailconfig['functions_files'] = get_funcs()
|
||||||
if relative_to:
|
dirs = [str(test_dir / 'rougail')]
|
||||||
dirs = [str((test_dir / 'rougail').relative_to(relative_to, walk_up=True))]
|
|
||||||
else:
|
|
||||||
dirs = [str((test_dir / 'rougail'))]
|
|
||||||
subfolder = test_dir / 'rougail2'
|
subfolder = test_dir / 'rougail2'
|
||||||
if subfolder.is_dir():
|
if subfolder.is_dir():
|
||||||
if relative_to:
|
dirs.append(str(subfolder))
|
||||||
dirs.append(str(subfolder.relative_to(relative_to, walk_up=True)))
|
rougailconfig['main_dictionaries'] = dirs
|
||||||
else:
|
|
||||||
dirs.append(str(subfolder))
|
|
||||||
rougailconfig['main_structural_directories'] = dirs
|
|
||||||
if namespace:
|
if namespace:
|
||||||
|
rougailconfig['main_namespace'] = 'Rougail'
|
||||||
if (test_dir / 'force_no_namespace').is_file():
|
if (test_dir / 'force_no_namespace').is_file():
|
||||||
return None
|
return None
|
||||||
rougailconfig['main_namespace'] = 'Rougail'
|
|
||||||
else:
|
else:
|
||||||
|
rougailconfig['main_namespace'] = None
|
||||||
if (test_dir / 'force_namespace').is_file():
|
if (test_dir / 'force_namespace').is_file():
|
||||||
return None
|
return None
|
||||||
rougailconfig['main_namespace'] = None
|
extra_dictionaries = {}
|
||||||
if (test_dir / 'default_structural_format_version').is_file():
|
|
||||||
rougailconfig["default_structural_format_version"] = "1.1"
|
|
||||||
else:
|
|
||||||
rougailconfig["default_structural_format_version"] = None
|
|
||||||
extra_namespaces = {}
|
|
||||||
extras = list(test_dir.iterdir())
|
extras = list(test_dir.iterdir())
|
||||||
extras.sort()
|
extras.sort()
|
||||||
for extra in extras:
|
for extra in extras:
|
||||||
if extra.name in ['rougail', 'rougail2', 'file']:
|
if extra.name in ['rougail', 'rougail2', 'file']:
|
||||||
continue
|
continue
|
||||||
if extra.is_dir():
|
if extra.is_dir():
|
||||||
if relative_to:
|
extra_dictionaries[extra.name] = [str(extra)]
|
||||||
extra_namespaces[extra.name] = [str(extra.relative_to(relative_to, walk_up=True))]
|
if extra_dictionaries:
|
||||||
else:
|
|
||||||
extra_namespaces[extra.name] = [str(extra)]
|
|
||||||
if extra_namespaces:
|
|
||||||
if not namespace:
|
if not namespace:
|
||||||
return None
|
return None
|
||||||
rougailconfig['extra_namespaces'] = extra_namespaces
|
rougailconfig['extra_dictionaries'] = extra_dictionaries
|
||||||
else:
|
else:
|
||||||
rougailconfig['extra_namespaces'] = {}
|
rougailconfig['extra_dictionaries'] = {}
|
||||||
rougailconfig['custom_types']['custom'] = CustomOption
|
rougailconfig['custom_types']['custom'] = CustomOption
|
||||||
# rougailconfig['tiramisu_cache'] = "cache.py"
|
# rougailconfig['tiramisu_cache'] = "cache.py"
|
||||||
return rougailconfig
|
return rougailconfig
|
||||||
|
|
||||||
|
|
||||||
def get_values_for_config(config, specify_dynamic_id=True, level="all", use_unrestraint=True, exclude_namespace=None):
|
def get_values_for_config(config, specify_dynamic_id=True, level="all", use_unrestraint=True):
|
||||||
# level is "all" or "mandatories"
|
# level is "all" or "mandatories"
|
||||||
|
|
||||||
if use_unrestraint:
|
if use_unrestraint:
|
||||||
|
|
@ -70,14 +56,14 @@ def get_values_for_config(config, specify_dynamic_id=True, level="all", use_unre
|
||||||
uconfig = config
|
uconfig = config
|
||||||
excludes = []
|
excludes = []
|
||||||
get_excludes(uconfig, excludes)
|
get_excludes(uconfig, excludes)
|
||||||
config.property.read_write()
|
config.property.read_only()
|
||||||
root_config = uconfig
|
root_config = uconfig
|
||||||
if level == 'all':
|
if level == 'all':
|
||||||
only = False
|
only = False
|
||||||
else:
|
else:
|
||||||
only = True
|
only = True
|
||||||
values = {}
|
values = {}
|
||||||
get_variables(root_config, root_config, values, only, excludes, specify_dynamic_id, use_unrestraint, exclude_namespace)
|
get_variables(root_config, root_config, values, only, excludes, specify_dynamic_id, use_unrestraint)
|
||||||
if not specify_dynamic_id:
|
if not specify_dynamic_id:
|
||||||
for exclude in excludes:
|
for exclude in excludes:
|
||||||
_values = values
|
_values = values
|
||||||
|
|
@ -125,15 +111,15 @@ def get_value(variable, index, excludes, config, use_unrestraint):
|
||||||
elif variable.type() == 'choice':
|
elif variable.type() == 'choice':
|
||||||
tests = variable.value.list()
|
tests = variable.value.list()
|
||||||
elif variable.type() == 'network address':
|
elif variable.type() == 'network address':
|
||||||
if variable.extra('cidr'):
|
if variable.extra('_cidr'):
|
||||||
tests = ['192.168.1.6/32', '10.0.0.0/24']
|
tests = ['192.168.1.0/24', '10.0.0.0/24']
|
||||||
else:
|
else:
|
||||||
tests = ['192.168.1.0', '10.0.0.0']
|
tests = ['192.168.1.0', '10.0.0.0']
|
||||||
elif variable.type() == 'netmask address':
|
elif variable.type() == 'netmask address':
|
||||||
tests = ['255.255.255.0', '255.255.0.0']
|
tests = ['255.255.255.0', '255.255.0.0']
|
||||||
elif variable.type() == 'IP':
|
elif variable.type() == 'IP':
|
||||||
if variable.extra('cidr'):
|
if variable.extra('_cidr'):
|
||||||
tests = ['192.168.1.6/24', '10.0.10.0/24']
|
tests = ['192.168.1.6/32', '10.0.10.0/24']
|
||||||
else:
|
else:
|
||||||
tests = ['192.168.1.6', '10.0.10.10']
|
tests = ['192.168.1.6', '10.0.10.10']
|
||||||
elif variable.type() == 'email address':
|
elif variable.type() == 'email address':
|
||||||
|
|
@ -151,25 +137,16 @@ def get_value(variable, index, excludes, config, use_unrestraint):
|
||||||
tests = ['string1', 'string2', 'string3']
|
tests = ['string1', 'string2', 'string3']
|
||||||
if not variable.ismulti():
|
if not variable.ismulti():
|
||||||
tests = tests[0]
|
tests = tests[0]
|
||||||
elif variable.isleader() and variable.owner.get() == owners.default:
|
|
||||||
len_leader = len(variable.value.get())
|
|
||||||
if len_leader:
|
|
||||||
for idx in range(len_leader - 1, -1, -1):
|
|
||||||
variable.value.pop(idx)
|
|
||||||
elif index is not None and variable.isfollower() and variable.issubmulti() is False:
|
elif index is not None and variable.isfollower() and variable.issubmulti() is False:
|
||||||
if len(tests) > index:
|
if len(tests) > index:
|
||||||
tests = tests[index]
|
tests = tests[index]
|
||||||
else:
|
else:
|
||||||
tests = tests[0]
|
tests = tests[0]
|
||||||
# if not use_unrestraint:
|
if not use_unrestraint:
|
||||||
# config.property.read_write()
|
config.property.read_write()
|
||||||
variable.value.set(tests)
|
variable.value.set(tests)
|
||||||
if variable.index() is None:
|
if not use_unrestraint:
|
||||||
variable.information.set('loaded_from', 'loaded from rougail-test')
|
config.property.read_only()
|
||||||
else:
|
|
||||||
no_index_variable = config.option(variable.path()).information.set(f'loaded_from_{index}', 'loaded from rougail-test')
|
|
||||||
# if not use_unrestraint:
|
|
||||||
# config.property.read_only()
|
|
||||||
# if tests == None:
|
# if tests == None:
|
||||||
# tests = ""
|
# tests = ""
|
||||||
if index is not None and variable.isleader():
|
if index is not None and variable.isleader():
|
||||||
|
|
@ -177,10 +154,8 @@ def get_value(variable, index, excludes, config, use_unrestraint):
|
||||||
return tests
|
return tests
|
||||||
|
|
||||||
|
|
||||||
def get_variables(root_config, config, values, only, excludes, specify_dynamic_id, use_unrestraint, exclude_namespace, *, index=None, leader_is_mandatory=False):
|
def get_variables(root_config, config, values, only, excludes, specify_dynamic_id, use_unrestraint, *, index=None, leader_is_mandatory=False):
|
||||||
for idx, key in enumerate(config):
|
for idx, key in enumerate(config):
|
||||||
if key.name() == exclude_namespace:
|
|
||||||
continue
|
|
||||||
if not use_unrestraint and 'hidden' in key.property.get():
|
if not use_unrestraint and 'hidden' in key.property.get():
|
||||||
continue
|
continue
|
||||||
if key.isoptiondescription():
|
if key.isoptiondescription():
|
||||||
|
|
@ -196,14 +171,14 @@ def get_variables(root_config, config, values, only, excludes, specify_dynamic_i
|
||||||
has_value = False
|
has_value = False
|
||||||
for idx_, val in enumerate(leader_value):
|
for idx_, val in enumerate(leader_value):
|
||||||
value.append({})
|
value.append({})
|
||||||
get_variables(root_config, key, value[-1], only, excludes, specify_dynamic_id, use_unrestraint, None, index=idx_, leader_is_mandatory=leader_is_mandatory)
|
get_variables(root_config, key, value[-1], only, excludes, specify_dynamic_id, use_unrestraint, index=idx_, leader_is_mandatory=leader_is_mandatory)
|
||||||
if value[-1]:
|
if value[-1]:
|
||||||
has_value = True
|
has_value = True
|
||||||
if has_value:
|
if has_value:
|
||||||
values[key.name()] = value
|
values[key.name()] = value
|
||||||
else:
|
else:
|
||||||
value = {}
|
value = {}
|
||||||
get_variables(root_config, key, value, only, excludes, specify_dynamic_id, use_unrestraint, None)
|
get_variables(root_config, key, value, only, excludes, specify_dynamic_id, use_unrestraint)
|
||||||
if value:
|
if value:
|
||||||
values[key.name()] = value
|
values[key.name()] = value
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
var1:
|
|
||||||
description: a first variable
|
|
||||||
multi: true
|
|
||||||
type: domainname
|
|
||||||
params:
|
|
||||||
allow_ip: true
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: a second variable
|
|
||||||
multi: true
|
|
||||||
type: domainname
|
|
||||||
default:
|
|
||||||
type: variable
|
|
||||||
variable: _.var1
|
|
||||||
|
|
@ -8,5 +8,5 @@ var:
|
||||||
{% for n in trange(0, 10) %}
|
{% for n in trange(0, 10) %}
|
||||||
{{ n }}
|
{{ n }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
return_type: 'integer'
|
return_type: 'number'
|
||||||
description: choices is 0 to 9
|
description: choices is 0 to 9
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
var1: 0 # the first variable
|
|
||||||
var2:
|
|
||||||
description: the second variable
|
|
||||||
default: 0
|
|
||||||
var3:
|
|
||||||
description: the third variable
|
|
||||||
type: integer
|
|
||||||
default: 0
|
|
||||||
var4: 10 # this forth variable
|
|
||||||
var5:
|
|
||||||
description: the fifth variable
|
|
||||||
default: 10
|
|
||||||
var6:
|
|
||||||
description: the sixth variable
|
|
||||||
type: integer
|
|
||||||
default: 10
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
var1:
|
|
||||||
description: an IP
|
|
||||||
type: ip
|
|
||||||
default: 1.1.1.1
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: an IP in CIDR format
|
|
||||||
type: ip
|
|
||||||
params:
|
|
||||||
cidr: true
|
|
||||||
default: 1.1.1.1/24
|
|
||||||
examples:
|
|
||||||
- 192.168.0.128/25
|
|
||||||
|
|
||||||
var3:
|
|
||||||
description: an IP in CIDR format with obsolete CIDR type
|
|
||||||
type: cidr
|
|
||||||
default: 1.1.1.1/24
|
|
||||||
...
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
var1:
|
|
||||||
description: an network
|
|
||||||
type: network
|
|
||||||
default: 1.1.1.0
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: an network in CIDR format
|
|
||||||
type: network
|
|
||||||
params:
|
|
||||||
cidr: true
|
|
||||||
default: 1.1.1.0/24
|
|
||||||
|
|
||||||
var3:
|
|
||||||
description: an network in CIDR format with obsolete CIDR type
|
|
||||||
type: network_cidr
|
|
||||||
default: 1.1.1.0/24
|
|
||||||
...
|
|
||||||
|
|
@ -15,9 +15,3 @@ var6:
|
||||||
description: the sixth variable
|
description: the sixth variable
|
||||||
type: string
|
type: string
|
||||||
default: value
|
default: value
|
||||||
var7:
|
|
||||||
description: the seventh variable
|
|
||||||
default: '8080'
|
|
||||||
var8:
|
|
||||||
description: the height variable
|
|
||||||
default: 'true'
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
my_variable:
|
|
||||||
default: val1
|
|
||||||
my_calculated_variable:
|
|
||||||
multi: true
|
|
||||||
default:
|
|
||||||
- variable: _.my_variable
|
|
||||||
optional: true
|
|
||||||
- variable: _.my_variable_unexists
|
|
||||||
optional: true
|
|
||||||
default: value
|
|
||||||
|
|
@ -8,5 +8,5 @@ var:
|
||||||
{% for item in trange(0, 10) %}
|
{% for item in trange(0, 10) %}
|
||||||
{{ item }}
|
{{ item }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
return_type: integer
|
return_type: number
|
||||||
description: choice for 0 to 9
|
description: choice for 0 to 9
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
var:
|
|
||||||
description: a variable
|
|
||||||
default: 9
|
|
||||||
choices:
|
|
||||||
jinja: |+
|
|
||||||
{% for item in trange(0, 10) %}
|
|
||||||
{{ item }}
|
|
||||||
{%- endfor %}
|
|
||||||
return_type: number
|
|
||||||
description: choice for 0 to 9
|
|
||||||
|
|
@ -8,7 +8,7 @@ var2:
|
||||||
- 0
|
- 0
|
||||||
var3:
|
var3:
|
||||||
description: the third variable
|
description: the third variable
|
||||||
type: integer
|
type: number
|
||||||
default:
|
default:
|
||||||
- 0
|
- 0
|
||||||
var4: # the forth variable
|
var4: # the forth variable
|
||||||
|
|
@ -19,7 +19,7 @@ var5:
|
||||||
- 10
|
- 10
|
||||||
var6:
|
var6:
|
||||||
description: the sixth variable
|
description: the sixth variable
|
||||||
type: integer
|
type: number
|
||||||
default:
|
default:
|
||||||
- 10
|
- 10
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ var7:
|
||||||
- 0
|
- 0
|
||||||
var8:
|
var8:
|
||||||
description: the eighth variable
|
description: the eighth variable
|
||||||
type: integer
|
type: number
|
||||||
multi: true
|
multi: true
|
||||||
default:
|
default:
|
||||||
- 0
|
- 0
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
choices:
|
|
||||||
variable: _.unknown_variable
|
|
||||||
optional: true
|
|
||||||
default:
|
|
||||||
- a
|
|
||||||
- b
|
|
||||||
- c
|
|
||||||
default: c
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
int:
|
|
||||||
description: A limited integer
|
|
||||||
default: 10
|
|
||||||
params:
|
|
||||||
min_integer: 0
|
|
||||||
max_integer: 100
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
condition: false # a condition
|
|
||||||
|
|
||||||
var1:
|
|
||||||
description: a first variable
|
|
||||||
mandatory: false
|
|
||||||
hidden:
|
|
||||||
variable: _.unknown
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: a first variable
|
|
||||||
mandatory: false
|
|
||||||
hidden:
|
|
||||||
variable: _.unknown
|
|
||||||
optional: true
|
|
||||||
default: true
|
|
||||||
|
|
||||||
var3:
|
|
||||||
description: a second variable
|
|
||||||
mandatory: false
|
|
||||||
hidden:
|
|
||||||
variable: _.condition
|
|
||||||
optional: true
|
|
||||||
default: true
|
|
||||||
|
|
||||||
var4:
|
|
||||||
description: a forth variable
|
|
||||||
mandatory: false
|
|
||||||
hidden:
|
|
||||||
variable: _.condition
|
|
||||||
optional: true
|
|
||||||
default: false
|
|
||||||
...
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
condition:
|
|
||||||
description: a condition
|
|
||||||
default: true
|
|
||||||
mandatory: true
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
disabled:
|
|
||||||
variable: _.condition
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
condition:
|
|
||||||
description: a condition
|
|
||||||
default: false
|
|
||||||
hidden: true
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
disabled:
|
|
||||||
variable: _.condition
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
condition:
|
|
||||||
description: a condition
|
|
||||||
default: false
|
|
||||||
disabled: true
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
disabled:
|
|
||||||
variable: _.condition
|
|
||||||
propertyerror: false
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
condition:
|
|
||||||
description: a condition
|
|
||||||
default: false
|
|
||||||
mandatory: true
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
disabled:
|
|
||||||
variable: _.condition
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
condition:
|
|
||||||
description: a condition
|
|
||||||
default: true
|
|
||||||
hidden: true
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
disabled:
|
|
||||||
variable: _.condition
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
condition:
|
|
||||||
description: a condition
|
|
||||||
default: true
|
|
||||||
disabled: true
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
disabled:
|
|
||||||
variable: _.condition
|
|
||||||
propertyerror: false
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
version: '1.1'
|
version: '1.1'
|
||||||
int:
|
int:
|
||||||
description: An integer
|
description: A number
|
||||||
type: integer
|
type: number
|
||||||
validators:
|
validators:
|
||||||
- jinja: |
|
- jinja: |
|
||||||
{% if _.int > 100 %}
|
{% if _.int > 100 %}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
my_family:
|
|
||||||
type: family
|
|
||||||
|
|
||||||
dynamic:
|
|
||||||
- 'val1'
|
|
||||||
- 'val2'
|
|
||||||
|
|
||||||
var: true # a variable
|
|
||||||
...
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
my_family:
|
|
||||||
type: family
|
|
||||||
|
|
||||||
default: true
|
|
||||||
...
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
version: '1.1'
|
version: '1.1'
|
||||||
general: # a family
|
general: # a family
|
||||||
int:
|
int:
|
||||||
description: a first integer
|
description: a first number
|
||||||
type: integer
|
type: number
|
||||||
test:
|
test:
|
||||||
- 5
|
- 5
|
||||||
validators:
|
validators:
|
||||||
|
|
@ -25,4 +25,4 @@ general: # a family
|
||||||
variable: _.int3
|
variable: _.int3
|
||||||
optional: true
|
optional: true
|
||||||
description: int and int3 must be different
|
description: int and int3 must be different
|
||||||
int2: 1 # a second integer
|
int2: 1 # a second number
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,6 @@ leader:
|
||||||
- c
|
- c
|
||||||
follower1:
|
follower1:
|
||||||
description: a follower
|
description: a follower
|
||||||
type: integer
|
type: number
|
||||||
default:
|
default:
|
||||||
type: index
|
type: index
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
leader:
|
|
||||||
description: a leadership
|
|
||||||
type: leadership
|
|
||||||
leader: # a leader
|
|
||||||
- a
|
|
||||||
- b
|
|
||||||
- c
|
|
||||||
follower1:
|
|
||||||
description: a follower
|
|
||||||
default:
|
|
||||||
type: index
|
|
||||||
|
|
@ -9,7 +9,7 @@ leader:
|
||||||
- c
|
- c
|
||||||
follower1:
|
follower1:
|
||||||
description: a follower
|
description: a follower
|
||||||
type: integer
|
type: number
|
||||||
default:
|
default:
|
||||||
jinja: '{{ index }}'
|
jinja: '{{ index }}'
|
||||||
params:
|
params:
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@ version: '1.1'
|
||||||
bool: false # a boolean variable
|
bool: false # a boolean variable
|
||||||
int1:
|
int1:
|
||||||
description: first integer variable
|
description: first integer variable
|
||||||
type: integer
|
type: number
|
||||||
default:
|
default:
|
||||||
jinja: |
|
jinja: |
|
||||||
{% if rougail.bool %}1{% else %}2{% endif %}
|
{% if rougail.bool %}1{% else %}2{% endif %}
|
||||||
description: if bool returns 1 otherwise return 2
|
description: if bool returns 1 otherwise return 2
|
||||||
int2:
|
int2:
|
||||||
description: second integer variable
|
description: second integer variable
|
||||||
type: integer
|
type: number
|
||||||
default:
|
default:
|
||||||
jinja: |
|
jinja: |
|
||||||
{% if not rougail.bool %}3{% else %}4{% endif %}
|
{% if not rougail.bool %}3{% else %}4{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
version: '1.1'
|
|
||||||
|
|
||||||
leadership:
|
|
||||||
description: a leadership
|
|
||||||
type: leadership
|
|
||||||
|
|
||||||
leader:
|
|
||||||
description: aleader
|
|
||||||
default:
|
|
||||||
- a
|
|
||||||
- b
|
|
||||||
|
|
||||||
follower:
|
|
||||||
description: a follower
|
|
||||||
default: value
|
|
||||||
disabled:
|
|
||||||
jinja: |
|
|
||||||
{% if not index %}
|
|
||||||
the first follower
|
|
||||||
{% endif %}
|
|
||||||
params:
|
|
||||||
index:
|
|
||||||
type: index
|
|
||||||
|
|
@ -4,7 +4,7 @@ var:
|
||||||
description: a suffix variable
|
description: a suffix variable
|
||||||
multi: true
|
multi: true
|
||||||
mandatory: false
|
mandatory: false
|
||||||
type: integer
|
type: number
|
||||||
test:
|
test:
|
||||||
- 1
|
- 1
|
||||||
- 2
|
- 2
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
"dyn{{ identifier }}":
|
|
||||||
description: a dynamic family
|
|
||||||
dynamic:
|
|
||||||
variable: _.unknown_var
|
|
||||||
optional: true
|
|
||||||
default:
|
|
||||||
- a
|
|
||||||
- b
|
|
||||||
|
|
||||||
var: val # a variable inside dynamic family
|
|
||||||
...
|
|
||||||
|
|
@ -20,9 +20,7 @@ var:
|
||||||
default:
|
default:
|
||||||
jinja: |
|
jinja: |
|
||||||
{% for val in __.var %}
|
{% for val in __.var %}
|
||||||
{% if val is not none %}
|
|
||||||
t{{ val }}
|
t{{ val }}
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
description: add 't' to each var value
|
description: add 't' to each var value
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue