first version with provider.factory.configure

This commit is contained in:
Emmanuel Garette 2020-03-20 22:23:20 +01:00
parent d424c9cd0b
commit 867de5f56e
2 changed files with 10 additions and 3 deletions

View File

@ -2,6 +2,7 @@ from os import environ
CONFIGURATION_DIR = 'configurations'
PROVIDER_FACTORY_CONFIG_DIR = environ.get('PROVIDER_FACTORY_CONFIG_DIR', 'factory')
TMP_DIR = 'tmp'
DEFAULT_USER = environ.get('DEFAULT_USER', 'Anonymous')
DEFAULT_DSN = environ.get('DEFAULT_DSN', 'postgres:///risotto?host=/var/run/postgresql/&user=risotto')
@ -31,4 +32,6 @@ def get_config():
'internal_release_name': 'none'},
'submodule': {'allow_insecure_https': False,
'pki': '192.168.56.112'},
'provider': {'factory_configuration_dir': PROVIDER_FACTORY_CONFIG_DIR,
'factory_configuration_filename': 'infra.json'},
}

View File

@ -2,7 +2,7 @@ from os import listdir
from os.path import join, basename, dirname, isfile
from glob import glob
from gettext import translation
from tiramisu import StrOption, IntOption, BoolOption, ChoiceOption, OptionDescription, SymLinkOption, \
from tiramisu import StrOption, IntOption, BoolOption, ChoiceOption, OptionDescription, SymLinkOption, FloatOption, \
Calculation, Params, ParamOption, ParamValue, calc_value, calc_value_property_help, \
groups, Option
from yaml import load, SafeLoader
@ -152,7 +152,7 @@ class ParameterDefinition:
def _valid_type(self, typ):
if typ.startswith('[]'):
self._valid_type(typ[2:])
elif typ not in ['Boolean', 'String', 'Number', 'File', 'Dict', 'Any']:
elif typ not in ['Boolean', 'String', 'Number', 'File', 'Dict', 'Any', 'Float']:
raise Exception(_('unknown parameter type: {}').format(typ))
@ -308,7 +308,8 @@ class CustomParam:
'number': 'Number',
'object': 'Dict',
'array': 'Array',
'file': 'File'}
'file': 'File',
'float': 'Float'}
if typ not in list(types.keys()):
# validate after
@ -463,6 +464,8 @@ def _get_option(name,
obj = IntOption(**kwargs)
elif type_ == 'Boolean':
obj = BoolOption(**kwargs)
elif type_ == 'Float':
obj = FloatOption(**kwargs)
else:
raise Exception('unsupported type {} in {}'.format(type_, file_path))
obj.impl_set_information('ref', arg.ref)
@ -513,6 +516,7 @@ def _parse_responses(message_def,
'Number': IntOption,
'Boolean': BoolOption,
'Dict': DictOption,
'Float': FloatOption,
# FIXME
'File': StrOption}.get(type_)
if not option: