forked from ungleich-public/cdist
strip away / in emulator in requirements
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
92de3d2f10
commit
5a72223ae3
1 changed files with 14 additions and 11 deletions
|
@ -147,21 +147,24 @@ class Emulator(object):
|
||||||
|
|
||||||
if "require" in os.environ:
|
if "require" in os.environ:
|
||||||
requirements = os.environ['require']
|
requirements = os.environ['require']
|
||||||
|
self.log.debug("reqs = " + requirements)
|
||||||
for requirement in requirements.split(" "):
|
for requirement in requirements.split(" "):
|
||||||
|
# Ignore empty fields - probably the only field anyway
|
||||||
|
if len(requirement) == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
self.log.debug("Recording requirement: " + requirement)
|
self.log.debug("Recording requirement: " + requirement)
|
||||||
requirement_parts = requirement.split(os.sep, 1)
|
requirement_parts = requirement.split(os.sep, 1)
|
||||||
requirement_parts.reverse()
|
requirement_type_name = requirement_parts[0]
|
||||||
# FIXME: continue here
|
requirement_object_id = requirement_parts[1]
|
||||||
FAILHERE,PLEASE()[]!
|
|
||||||
print(requirement)
|
|
||||||
print(requirement_parts)
|
|
||||||
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'
|
|
||||||
|
|
||||||
|
# FIXME: Add support for omitted object id == singleton
|
||||||
|
#if len(requirement_parts) == 1:
|
||||||
|
#except IndexError:
|
||||||
|
# # no object id, must be singleton
|
||||||
|
# requirement_object_id = 'singleton'
|
||||||
|
|
||||||
|
# Remove / if existent in object id
|
||||||
requirement_object_id = requirement_object_id.lstrip('/')
|
requirement_object_id = requirement_object_id.lstrip('/')
|
||||||
self.cdist_object.requirements.append(requirement)
|
self.cdist_object.requirements.append(requirement)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue