Compare commits
4 Commits
881b551f47
...
81028d1539
Author | SHA1 | Date | |
---|---|---|---|
81028d1539 | |||
2f8fc054d0 | |||
f19a427f46 | |||
f062d9f30a |
@ -58,10 +58,10 @@
|
|||||||
<!ATTLIST action actionlist CDATA #IMPLIED>
|
<!ATTLIST action actionlist CDATA #IMPLIED>
|
||||||
<!-- for apache action -->
|
<!-- for apache action -->
|
||||||
<!ATTLIST action apache_path CDATA #IMPLIED>
|
<!ATTLIST action apache_path CDATA #IMPLIED>
|
||||||
<!ATTLIST action apache_path_type (FilenameOption|SymLinkOption) "FilenameOption">
|
<!ATTLIST action apache_path_type (FilenameOption|SymLinkOption|variable) "FilenameOption">
|
||||||
<!-- for external action -->
|
<!-- for external action -->
|
||||||
<!ATTLIST action url CDATA #IMPLIED>
|
<!ATTLIST action url CDATA #IMPLIED>
|
||||||
<!ATTLIST action url_type (URLOption|SymLinkOption) "URLOption">
|
<!ATTLIST action url_type (URLOption|SymLinkOption|variable) "URLOption">
|
||||||
<!-- for form action -->
|
<!-- for form action -->
|
||||||
<!ATTLIST action save (True|False) "False">
|
<!ATTLIST action save (True|False) "False">
|
||||||
|
|
||||||
@ -89,12 +89,12 @@
|
|||||||
<!ATTLIST service_access service CDATA #REQUIRED >
|
<!ATTLIST service_access service CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT port (#PCDATA)> <!--port_type-->
|
<!ELEMENT port (#PCDATA)> <!--port_type-->
|
||||||
<!ATTLIST port port_type (PortOption|SymLinkOption) "PortOption">
|
<!ATTLIST port port_type (PortOption|SymLinkOption|variable) "PortOption">
|
||||||
<!ATTLIST port service_accesslist CDATA #IMPLIED >
|
<!ATTLIST port service_accesslist CDATA #IMPLIED >
|
||||||
<!ATTLIST port protocol (tcp|udp) "tcp">
|
<!ATTLIST port protocol (tcp|udp) "tcp">
|
||||||
|
|
||||||
<!ELEMENT tcpwrapper (#PCDATA)> <!--tcpwrapper_type-->
|
<!ELEMENT tcpwrapper (#PCDATA)> <!--tcpwrapper_type-->
|
||||||
<!ATTLIST tcpwrapper tcpwrapper_type (UnicodeOption|SymLinkOption) "UnicodeOption">
|
<!ATTLIST tcpwrapper tcpwrapper_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
|
||||||
<!ATTLIST tcpwrapper service_accesslist CDATA #IMPLIED >
|
<!ATTLIST tcpwrapper service_accesslist CDATA #IMPLIED >
|
||||||
|
|
||||||
<!ELEMENT service_restriction (ip*)>
|
<!ELEMENT service_restriction (ip*)>
|
||||||
@ -102,42 +102,42 @@
|
|||||||
|
|
||||||
<!ELEMENT ip (#PCDATA)> <!--ip_type-->
|
<!ELEMENT ip (#PCDATA)> <!--ip_type-->
|
||||||
<!ATTLIST ip service_restrictionlist CDATA #IMPLIED >
|
<!ATTLIST ip service_restrictionlist CDATA #IMPLIED >
|
||||||
<!ATTLIST ip ip_type (NetworkOption|SymLinkOption) "NetworkOption">
|
<!ATTLIST ip ip_type (NetworkOption|SymLinkOption|variable) "NetworkOption">
|
||||||
<!ATTLIST ip interface_type (UnicodeOption|SymLinkOption) "UnicodeOption">
|
<!ATTLIST ip interface_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
|
||||||
<!ATTLIST ip interface CDATA #REQUIRED> <!--interface_type-->
|
<!ATTLIST ip interface CDATA #REQUIRED> <!--interface_type-->
|
||||||
<!ATTLIST ip netmask_type (NetmaskOption|SymLinkOption) "NetmaskOption">
|
<!ATTLIST ip netmask_type (NetmaskOption|SymLinkOption|variable) "NetmaskOption">
|
||||||
<!ATTLIST ip netmask CDATA "255.255.255.255"> <!--netmask_type-->
|
<!ATTLIST ip netmask CDATA "255.255.255.255"> <!--netmask_type-->
|
||||||
|
|
||||||
<!ELEMENT interface (#PCDATA)>
|
<!ELEMENT interface (#PCDATA)>
|
||||||
<!ATTLIST interface interfacelist CDATA #IMPLIED >
|
<!ATTLIST interface interfacelist CDATA #IMPLIED >
|
||||||
<!ATTLIST interface linkto CDATA #REQUIRED >
|
<!ATTLIST interface linkto CDATA #REQUIRED >
|
||||||
<!ATTLIST interface ip CDATA #REQUIRED> <!--SymLinkOption-->
|
<!ATTLIST interface ip CDATA #REQUIRED> <!--variable-->
|
||||||
<!ATTLIST interface ip_type (SymLinkOption) "SymLinkOption">
|
<!ATTLIST interface ip_type (SymLinkOption|variable) "variable">
|
||||||
<!ATTLIST interface mask CDATA #REQUIRED> <!--SymLinkOption-->
|
<!ATTLIST interface mask CDATA #REQUIRED> <!--variable-->
|
||||||
<!ATTLIST interface mask_type (SymLinkOption) "SymLinkOption">
|
<!ATTLIST interface mask_type (SymLinkOption|variable) "variable">
|
||||||
<!ATTLIST interface bcast CDATA #IMPLIED> <!--SymLinkOption-->
|
<!ATTLIST interface bcast CDATA #IMPLIED> <!--variable-->
|
||||||
<!ATTLIST interface bcast_type (SymLinkOption) "SymLinkOption">
|
<!ATTLIST interface bcast_type (SymLinkOption|variable) "variable">
|
||||||
<!ATTLIST interface gateway CDATA #IMPLIED> <!--SymLinkOption-->
|
<!ATTLIST interface gateway CDATA #IMPLIED> <!--variable-->
|
||||||
<!ATTLIST interface gateway_type (SymLinkOption) "SymLinkOption">
|
<!ATTLIST interface gateway_type (variable) "variable">
|
||||||
<!ATTLIST interface method (bridge|macvlan) "macvlan" >
|
<!ATTLIST interface method (bridge|macvlan) "macvlan" >
|
||||||
<!ATTLIST interface redefine (True|False) "False">
|
<!ATTLIST interface redefine (True|False) "False">
|
||||||
|
|
||||||
<!ELEMENT host EMPTY >
|
<!ELEMENT host EMPTY >
|
||||||
<!ATTLIST host hostlist CDATA #IMPLIED >
|
<!ATTLIST host hostlist CDATA #IMPLIED >
|
||||||
<!ATTLIST host name CDATA #REQUIRED > <!--SymLinkOption-->
|
<!ATTLIST host name CDATA #REQUIRED > <!--variable-->
|
||||||
<!ATTLIST host name_type (SymLinkOption) "SymLinkOption">
|
<!ATTLIST host name_type (SymLinkOption|variable) "variable">
|
||||||
<!ATTLIST host ip CDATA #REQUIRED > <!--SymLinkOption-->
|
<!ATTLIST host ip CDATA #REQUIRED > <!--variable-->
|
||||||
<!ATTLIST host ip_type (SymLinkOption) "SymLinkOption">
|
<!ATTLIST host ip_type (SymLinkOption|variable) "variable">
|
||||||
<!ATTLIST host crossed (True|False) "True" >
|
<!ATTLIST host crossed (True|False) "True" >
|
||||||
<!ATTLIST host comment CDATA #IMPLIED >
|
<!ATTLIST host comment CDATA #IMPLIED >
|
||||||
|
|
||||||
<!ELEMENT fstab EMPTY >
|
<!ELEMENT fstab EMPTY >
|
||||||
<!ATTLIST fstab name CDATA #REQUIRED> <!--name_type-->
|
<!ATTLIST fstab name CDATA #REQUIRED> <!--name_type-->
|
||||||
<!ATTLIST fstab name_type (FilenameOption|SymLinkOption) "FilenameOption">
|
<!ATTLIST fstab name_type (FilenameOption|SymLinkOption|variable) "FilenameOption">
|
||||||
<!ATTLIST fstab type (bind|normal) "bind">
|
<!ATTLIST fstab type (bind|normal) "bind">
|
||||||
<!ATTLIST fstab fstype (auto|ext3|ext4|nfs|smb) "auto">
|
<!ATTLIST fstab fstype (auto|ext3|ext4|nfs|smb) "auto">
|
||||||
<!ATTLIST fstab mount_point CDATA #IMPLIED> <!--mount_point_type-->
|
<!ATTLIST fstab mount_point CDATA #IMPLIED> <!--mount_point_type-->
|
||||||
<!ATTLIST fstab mount_point_type (FilenameOption|SymLinkOption) "FilenameOption">
|
<!ATTLIST fstab mount_point_type (FilenameOption|SymLinkOption|variable) "FilenameOption">
|
||||||
<!ATTLIST fstab options CDATA #IMPLIED>
|
<!ATTLIST fstab options CDATA #IMPLIED>
|
||||||
<!ATTLIST fstab checks CDATA #IMPLIED>
|
<!ATTLIST fstab checks CDATA #IMPLIED>
|
||||||
<!ATTLIST fstab fstablist CDATA #IMPLIED>
|
<!ATTLIST fstab fstablist CDATA #IMPLIED>
|
||||||
@ -149,7 +149,7 @@
|
|||||||
|
|
||||||
<!ELEMENT file EMPTY>
|
<!ELEMENT file EMPTY>
|
||||||
<!ATTLIST file name CDATA #REQUIRED >
|
<!ATTLIST file name CDATA #REQUIRED >
|
||||||
<!ATTLIST file name_type (UnicodeOption|SymLinkOption) "UnicodeOption">
|
<!ATTLIST file name_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
|
||||||
<!ATTLIST file source CDATA #IMPLIED>
|
<!ATTLIST file source CDATA #IMPLIED>
|
||||||
<!ATTLIST file mode CDATA #IMPLIED >
|
<!ATTLIST file mode CDATA #IMPLIED >
|
||||||
<!ATTLIST file owner CDATA #IMPLIED >
|
<!ATTLIST file owner CDATA #IMPLIED >
|
||||||
|
@ -64,7 +64,8 @@ FORCE_CHOICE = {'oui/non': ['oui', 'non'],
|
|||||||
'schedule': ['none', 'daily', 'weekly', 'monthly'],
|
'schedule': ['none', 'daily', 'weekly', 'monthly'],
|
||||||
'schedulemod': ['pre', 'post']}
|
'schedulemod': ['pre', 'post']}
|
||||||
|
|
||||||
KEY_TYPE = {'SymLinkOption': 'symlink',
|
KEY_TYPE = {'variable': 'symlink',
|
||||||
|
'SymLinkOption': 'symlink',
|
||||||
'PortOption': 'port',
|
'PortOption': 'port',
|
||||||
'UnicodeOption': 'string',
|
'UnicodeOption': 'string',
|
||||||
'NetworkOption': 'network',
|
'NetworkOption': 'network',
|
||||||
|
@ -21,9 +21,16 @@ from .i18n import _
|
|||||||
from .xmlreflector import HIGH_COMPATIBILITY
|
from .xmlreflector import HIGH_COMPATIBILITY
|
||||||
#from . import eosfunc
|
#from . import eosfunc
|
||||||
from .objspace import CreoleObjSpace
|
from .objspace import CreoleObjSpace
|
||||||
|
from .utils import normalize_family
|
||||||
import imp
|
import imp
|
||||||
|
|
||||||
|
|
||||||
|
class ConvertDynOptionDescription(DynOptionDescription):
|
||||||
|
def convert_suffix_to_path(self, suffix):
|
||||||
|
return normalize_family(suffix,
|
||||||
|
check_name=False)
|
||||||
|
|
||||||
|
|
||||||
class CreoleLoaderError(Exception):
|
class CreoleLoaderError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -539,7 +546,7 @@ class Family(Common):
|
|||||||
del self.attrib['dynamic']
|
del self.attrib['dynamic']
|
||||||
self.attrib['suffixes'] = Calculation(self.eosfunc.calc_value,
|
self.attrib['suffixes'] = Calculation(self.eosfunc.calc_value,
|
||||||
Params((ParamOption(dynamic),)))
|
Params((ParamOption(dynamic),)))
|
||||||
option = DynOptionDescription(**self.attrib)
|
option = ConvertDynOptionDescription(**self.attrib)
|
||||||
elif not self.is_leader:
|
elif not self.is_leader:
|
||||||
option = OptionDescription(**self.attrib)
|
option = OptionDescription(**self.attrib)
|
||||||
else:
|
else:
|
||||||
|
@ -601,7 +601,9 @@ class Path(object):
|
|||||||
def get_family_path(self, name, current_namespace): # pylint: disable=C0111
|
def get_family_path(self, name, current_namespace): # pylint: disable=C0111
|
||||||
if current_namespace is None: # pragma: no cover
|
if current_namespace is None: # pragma: no cover
|
||||||
raise CreoleOperationError('current_namespace must not be None')
|
raise CreoleOperationError('current_namespace must not be None')
|
||||||
dico = self.families[normalize_family(name, check_name=False)]
|
dico = self.families[normalize_family(name,
|
||||||
|
check_name=False,
|
||||||
|
allow_dot=True)]
|
||||||
if dico['namespace'] != 'creole' and current_namespace != dico['namespace']:
|
if dico['namespace'] != 'creole' and current_namespace != dico['namespace']:
|
||||||
raise CreoleDictConsistencyError(_('A family located in the {} namespace '
|
raise CreoleDictConsistencyError(_('A family located in the {} namespace '
|
||||||
'shall not be used in the {} namespace').format(
|
'shall not be used in the {} namespace').format(
|
||||||
|
@ -2,25 +2,23 @@
|
|||||||
utilitaires créole
|
utilitaires créole
|
||||||
"""
|
"""
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
from .i18n import _
|
||||||
|
|
||||||
|
|
||||||
# définition des classes d'adresse IP existantes
|
def normalize_family(family_name: str,
|
||||||
def normalize_family(family_name, check_name=True):
|
check_name: bool=True,
|
||||||
"""
|
allow_dot: bool=False) -> str:
|
||||||
il ne faut pas d'espace, d'accent, de majuscule, de tiré, ...
|
"""replace space, accent, uppercase, ... by valid character
|
||||||
dans le nom des familles
|
|
||||||
"""
|
"""
|
||||||
f = family_name
|
f = family_name
|
||||||
f = f.replace('-', '_')
|
f = f.replace('-', '_')
|
||||||
#f = f.replace(u'é', 'e')
|
if not allow_dot:
|
||||||
#f = f.replace(u'è', 'e')
|
f = f.replace('.', '_')
|
||||||
nfkd_form = unicodedata.normalize('NFKD', f)
|
|
||||||
f = u"".join([c for c in nfkd_form if not unicodedata.combining(c)])
|
|
||||||
f = f.replace(' ', '_')
|
f = f.replace(' ', '_')
|
||||||
|
nfkd_form = unicodedata.normalize('NFKD', f)
|
||||||
|
f = ''.join([c for c in nfkd_form if not unicodedata.combining(c)])
|
||||||
f = f.lower()
|
f = f.lower()
|
||||||
if f[0].isnumeric():
|
|
||||||
raise ValueError(u'Le nom de la famille ne doit pas commencer par un chiffre : {0}'.format(f))
|
|
||||||
if check_name and f == 'containers':
|
if check_name and f == 'containers':
|
||||||
raise ValueError(u'nom de la famille interdit {0}'.format(f))
|
raise ValueError(_('"{0}" is a forbidden family name'.format(f)))
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user