CORD-2931 fix ValidationError;
eliminate requirement that slice names are prefixed by site
Change-Id: If8ad902302e442c4f2566713b7af556d284dd9cd
diff --git a/lib/xos-genx/xosgenx/jinja2_extensions/fol2.py b/lib/xos-genx/xosgenx/jinja2_extensions/fol2.py
index 3042e37..73d04af 100644
--- a/lib/xos-genx/xosgenx/jinja2_extensions/fol2.py
+++ b/lib/xos-genx/xosgenx/jinja2_extensions/fol2.py
@@ -423,7 +423,7 @@
self.verdict_next()
function_str = """
def %(fn_name)s(obj, ctx):
- if not %(vvar)s: raise ValidationError("%(message)s".format(obj=obj, ctx=ctx))
+ if not %(vvar)s: raise XOSValidationError("%(message)s".format(obj=obj, ctx=ctx))
""" % {'fn_name': policy_function_name, 'vvar': self.verdict_variable, 'message': message}
function_ast = self.str_to_ast(function_str)
diff --git a/xos/core/models/core.xproto b/xos/core/models/core.xproto
index 07b4dd4..144c3c2 100644
--- a/xos/core/models/core.xproto
+++ b/xos/core/models/core.xproto
@@ -465,14 +465,11 @@
required string role = 1 [choices = "(('admin', 'Admin'), ('pi', 'PI'), ('tech', 'Tech'), ('billing', 'Billing'))", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False, tosca_key=True];
}
-policy slice_name < obj.id | {{ obj.name.startswith(obj.site.login_base) }} >
policy slice_name_length_and_no_spaces < {{ len(obj.site.login_base) + 1 < len(obj.name) and ' ' not in obj.name }} >
policy slice_has_creator < obj.creator >
-
-
message Slice::slice_policy (XOSBase) {
- option validators = "slice_name:Slice name ({obj.name}) must begin with site login_base ({obj.site.login_base}), slice_name_length_and_no_spaces:Slice name too short or contains spaces, slice_has_creator:Slice has no creator";
+ option validators = "slice_name_length_and_no_spaces:Slice name too short or contains spaces, slice_has_creator:Slice has no creator";
option plural = "Slices";
required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", null = False, db_index = False];