allow only enforce login base prefix on new slices
authorTony Mack <tmack@tux.cs.princeton.edu>
Wed, 24 Sep 2014 16:44:22 +0000 (12:44 -0400)
committerTony Mack <tmack@tux.cs.princeton.edu>
Wed, 24 Sep 2014 16:44:22 +0000 (12:44 -0400)
planetstack/core/models/slice.py

index 12c278b..7915d42 100644 (file)
@@ -42,7 +42,8 @@ class Slice(PlCoreBase):
     def save(self, *args, **kwds):
         
         site = Site.objects.get(id=self.site.id)
-        if not self.name.startswith(site.login_base):
+        # allow preexisting slices to keep their original name for now
+        if not self.id and not self.name.startswith(site.login_base):
             raise ValidationError('slice name must begin with %s' % site.login_base)
         
         if self.serviceClass is None: