From: Thierry Parmentelat Date: Mon, 12 Dec 2016 10:18:45 +0000 (+0100) Subject: r2lab is migrating from a previous depl. based on omf_sfa X-Git-Tag: plcapi-5.3-11~5 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=13901cd4465288b634103c1997a5653500f2b5cc r2lab is migrating from a previous depl. based on omf_sfa and so it comes with rather long dot-separated names allow ‘.’ on both sides of the _ in slice names, and so also allow ‘.’ in site login_base --- diff --git a/PLC/Methods/AddSlice.py b/PLC/Methods/AddSlice.py index 0d6c1c6..51918f4 100644 --- a/PLC/Methods/AddSlice.py +++ b/PLC/Methods/AddSlice.py @@ -63,7 +63,7 @@ class AddSlice(Method): # 3. Then single underscore after login_base. # 4. Then letters, numbers, or underscores. name = slice_fields['name'] - good_name = r'^[a-z0-9]+_[a-zA-Z0-9_]+$' + good_name = r'^[a-z0-9\.]+_[a-zA-Z0-9_\.]+$' if not name or \ not re.match(good_name, name): raise PLCInvalidArgument, "Invalid slice name" diff --git a/PLC/Sites.py b/PLC/Sites.py index 969b2a9..2075409 100644 --- a/PLC/Sites.py +++ b/PLC/Sites.py @@ -69,8 +69,8 @@ class Site(Row): if not len(login_base): raise PLCInvalidArgument, "Login base must be specified" - if not set(login_base).issubset(string.lowercase + string.digits): - raise PLCInvalidArgument, "Login base must consist only of lowercase ASCII letters or numbers" + if not set(login_base).issubset(string.lowercase + string.digits + '.'): + raise PLCInvalidArgument, "Login base must consist only of lowercase ASCII letters or numbers or dots" conflicts = Sites(self.api, [login_base]) for site in conflicts: diff --git a/PLC/Slices.py b/PLC/Slices.py index 7226857..e5a51eb 100644 --- a/PLC/Slices.py +++ b/PLC/Slices.py @@ -60,7 +60,7 @@ class Slice(Row): # 2. Begins with login_base (letters or numbers). # 3. Then single underscore after login_base. # 4. Then letters, numbers, or underscores. - good_name = r'^[a-z0-9]+_[a-zA-Z0-9_]+$' + good_name = r'^[a-z0-9\.]+_[a-zA-Z0-9_\.]+$' if not name or \ not re.match(good_name, name): raise PLCInvalidArgument, "Invalid slice name"