[Kimchi-devel] [PATCH V2] Remove slash "/" filter in template name when create VM
Daniel Henrique Barboza
dhbarboza82 at gmail.com
Thu Mar 12 19:58:53 UTC 2015
Reviewed-by: Daniel Barboza <dhbarboza82 at gmail.com>
Tested-by: Daniel Barboza <dhbarboza82 at gmail.com>
On 03/12/2015 04:02 PM, Rodrigo Trujillo wrote:
> 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})
More information about the Kimchi-devel
mailing list