r2lab is migrating from a previous depl. based on omf_sfa
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 12 Dec 2016 10:18:45 +0000 (11:18 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 12 Dec 2016 10:18:45 +0000 (11:18 +0100)
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

PLC/Methods/AddSlice.py
PLC/Sites.py
PLC/Slices.py

index 0d6c1c6..51918f4 100644 (file)
@@ -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"
index 969b2a9..2075409 100644 (file)
@@ -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:
index 7226857..e5a51eb 100644 (file)
@@ -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"