Reviewed-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
On 24/03/2015 13:46, Rodrigo Trujillo wrote:
This patch adds the JSON checking for Network name, when user tries
to
create a new network using the API directly.
Slashes are not allowed by default, but quotes should also be avoided
due to an error raised in /sbin/dnsmasq.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/API.json | 1 +
src/kimchi/i18n.py | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 9d54665..fa18e84 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -319,6 +319,7 @@
"description": "The name of the new network",
"type": "string",
"minLength": 1,
+ "pattern": "^[^/\"]*$",
"required": true,
"error": "KCHNET0011E"
},
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 0a2a59d..34137f1 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -224,7 +224,7 @@ messages = {
"KCHNET0008E": _("Unable to create network %(name)s. Details:
%(err)s"),
"KCHNET0009E": _("Unable to find a free IP address for network
'%(name)s'"),
"KCHNET0010E": _("The interface %(iface)s already exists."),
- "KCHNET0011E": _("Network name must be a string"),
+ "KCHNET0011E": _("Network name must be a string without slashes (/)
or quotes (\")"),
"KCHNET0012E": _("Supported network types are isolated, NAT and
bridge"),
"KCHNET0013E": _("Network subnet must be a string with IP address
and prefix or netmask"),
"KCHNET0014E": _("Network interface must be a string"),