Add check for '.' in require/watch requisites

This commit will cause require/watch requisites to fail if they contain
dots. The prior behavior just ignored the dot, but since the function
name is ignored, and dots are already illegal in prereq requisites, this
commit makes the behavior more consistent.
This commit is contained in:
Erik Johnson 2013-12-05 15:31:40 -06:00
parent 3970c1ba77
commit bd9302ccfe

View File

@ -341,6 +341,19 @@ class Compiler(object):
continue
req_key = next(iter(req))
req_val = req[req_key]
if '.' in req_key:
errors.append((
'Invalid requisite type {0!r} '
'in state {1!r}, in SLS '
'{2!r}. Requisite types must '
'not contain periods, did you '
'mean {3!r}?'.format(
req_key,
name,
body['__sls__'],
req_key[:req_key.find('.')]
)
))
if not ishashable(req_val):
errors.append((
'Illegal requisite "{0}", '
@ -805,6 +818,19 @@ class State(object):
continue
req_key = next(iter(req))
req_val = req[req_key]
if '.' in req_key:
errors.append((
'Invalid requisite type {0!r} '
'in state {1!r}, in SLS '
'{2!r}. Requisite types must '
'not contain periods, did you '
'mean {3!r}?'.format(
req_key,
name,
body['__sls__'],
req_key[:req_key.find('.')]
)
))
if not ishashable(req_val):
errors.append((
'Illegal requisite "{0}", '