forked from ungleich-public/cdist
emulator: fail if object_id of requirement starts with slash
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
d346364544
commit
f285d9e64e
1 changed files with 13 additions and 2 deletions
|
@ -106,8 +106,19 @@ def run(argv):
|
||||||
# Record requirements
|
# Record requirements
|
||||||
if "require" in os.environ:
|
if "require" in os.environ:
|
||||||
requirements = os.environ['require']
|
requirements = os.environ['require']
|
||||||
log.debug("%s:Writing requirements: %s" % (cdist_object.path, requirements))
|
for requirement in requirements.split(" "):
|
||||||
cdist_object.requirements.extend(requirements.split(" "))
|
requirement_parts = requirement.split(os.sep, 1)
|
||||||
|
requirement_parts.reverse()
|
||||||
|
requirement_type_name = requirement_parts.pop()
|
||||||
|
try:
|
||||||
|
requirement_object_id = requirement_parts.pop()
|
||||||
|
except IndexError:
|
||||||
|
# no object id, must be singleton
|
||||||
|
requirement_object_id = 'singleton'
|
||||||
|
if requirement_object_id.startswith('/'):
|
||||||
|
raise core.IllegalObjectIdError(requirement_object_id, 'object_id may not start with /')
|
||||||
|
log.debug("Recording requirement: %s -> %s" % (cdist_object.path, requirement))
|
||||||
|
cdist_object.requirements.append(rement_object_id)
|
||||||
|
|
||||||
# Record / Append source
|
# Record / Append source
|
||||||
cdist_object.source.append(object_source)
|
cdist_object.source.append(object_source)
|
||||||
|
|
Loading…
Reference in a new issue