From 2246b7496ba8c21ecca5737dff5dbe0d963fe4c2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:50:28 +0200 Subject: [PATCH] fails if requirement has illegal object_id Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index b5682342..10c2dbaa 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -158,9 +158,6 @@ class Emulator(object): requirement_type_name = requirement_parts[0] requirement_object_id = requirement_parts[1] - # Instantiate type which fails if type does not exist - requirement_type = core.Type(self.type_base_path, requirement_type_name) - # FIXME: Add support for omitted object id == singleton #if len(requirement_parts) == 1: #except IndexError: @@ -170,6 +167,11 @@ class Emulator(object): # Remove / if existent in object id requirement_object_id = requirement_object_id.lstrip('/') + # Instantiate type which fails if type does not exist + requirement_type = core.Type(self.type_base_path, requirement_type_name) + # Instantiate object which fails if the object_id is illegal + requirement_object = core.Object(requirement_type, self.object_base_path, requirement_object_id) + # Construct cleaned up requirement with only one / :-) requirement = requirement_type_name + '/' + requirement_object_id self.cdist_object.requirements.append(requirement)