remove domain and hostname type a rename *_strict types

This commit is contained in:
Emmanuel Garette 2020-07-29 16:15:10 +02:00
parent cc2f7b64b1
commit 08f4362816
3 changed files with 8 additions and 10 deletions

View File

@ -29,7 +29,7 @@ from lxml.etree import Element, SubElement # pylint: disable=E0611
from .i18n import _ from .i18n import _
from .xmlreflector import XMLReflector from .xmlreflector import XMLReflector
from .annotator import ERASED_ATTRIBUTES, SpaceAnnotator from .annotator import ERASED_ATTRIBUTES, SpaceAnnotator
from .loader import PopulateTiramisuObjects from .tiramisureflector import TiramisuReflector
from .utils import normalize_family from .utils import normalize_family
from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError
from .path import Path from .path import Path
@ -525,7 +525,7 @@ class CreoleObjSpace:
def save(self, def save(self,
filename, filename,
): ):
tiramisu_objects = PopulateTiramisuObjects(self.space, tiramisu_objects = TiramisuReflector(self.space,
self.funcs_path, self.funcs_path,
) )
return tiramisu_objects.get_text() + '\n' return tiramisu_objects.get_text() + '\n'

View File

@ -31,10 +31,8 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
'network': dict(opttype="NetworkOption"), 'network': dict(opttype="NetworkOption"),
'broadcast': dict(opttype="BroadcastOption"), 'broadcast': dict(opttype="BroadcastOption"),
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}), 'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}),
'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': True, 'allow_without_dot': True}), 'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}),
'domain_strict': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}), 'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}),
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': True}),
'hostname_strict': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}),
'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, 'allow_without_dot': True}), 'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, 'allow_without_dot': True}),
'port': dict(opttype="PortOption", initkwargs={'allow_private': True}), 'port': dict(opttype="PortOption", initkwargs={'allow_private': True}),
'mac': dict(opttype="MACOption"), 'mac': dict(opttype="MACOption"),
@ -43,7 +41,7 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
} }
class PopulateTiramisuObjects: class TiramisuReflector:
def __init__(self, def __init__(self,
xmlroot, xmlroot,
funcs_path, funcs_path,

View File

@ -3,7 +3,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
import imp import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py') func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_3 = DomainnameOption(type='domainname', allow_ip=True, allow_without_dot=True, properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={}))) option_3 = DomainnameOption(type='domainname', allow_ip=False, properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={})))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])