Commit 585bf866 authored by Daniele Venzano's avatar Daniele Venzano

Validate service names in ZApp descriptions

Fixes #29
parent 4df666f2
......@@ -18,6 +18,7 @@ This module contains code to validate application descriptions.
"""
import logging
import re
from zoe_lib.exceptions import InvalidApplicationDescription
import zoe_lib.version
......@@ -84,6 +85,9 @@ def _service_check(data):
if k not in data:
raise InvalidApplicationDescription(msg="Missing required key: %s" % k)
if not re.match(r'^[a-zA-Z0-9\-]+$', data['name']):
raise InvalidApplicationDescription("Service name can contain only letters, numbers and dashes. '{}' is not valid.".format(data['name']))
try:
bool(data['monitor'])
except ValueError:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment