[Kimchi-devel] [PATCH V2] Remove slash "/" filter in template name when create VM

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Thu Mar 12 19:02:04 UTC 2015


Users are allowed to create or update template names with "slash",
this generates an error when he tries to create a guest with that
template because the guest paramters validation prohibits slashes
in templates names. This patch fixes this problem.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 src/kimchi/API.json | 2 +-
 src/kimchi/utils.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 0cfa20c..f507251 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -233,7 +233,7 @@
                 "template": {
                     "description": "The URI of a template to use when building a VM",
                     "type": "string",
-                    "pattern": "^/templates/[^/]+/?$",
+                    "pattern": "^/templates/(.*?)/?$",
                     "required": true,
                     "error": "KCHVM0012E"
                 },
diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index f1ef12c..0d5f988 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -45,7 +45,7 @@ task_id = 0
 
 
 def _uri_to_name(collection, uri):
-    expr = '/%s/(.*?)/?$' % collection
+    expr = '/%s/(.*?)$' % collection
     m = re.match(expr, uri)
     if not m:
         raise InvalidParameter("KCHUTILS0001E", {'uri': uri})
-- 
2.1.0




More information about the Kimchi-devel mailing list