From 030d5919e621cc696ba647d571a73373c3d92664 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:42:57 +0200 Subject: [PATCH] raise exception if object_id contains .cdist Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index eeb5799b..f22c206a 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -88,8 +88,11 @@ class Object(object): return self.__class__(self.type.__class__(type_path, type_name), object_path, object_id=object_id) def __init__(self, cdist_type, base_path, object_id=None): - if object_id and object_id.startswith('/'): - raise IllegalObjectIdError(object_id, 'object_id may not start with /') + if object_id: + if object_id.startswith('/'): + raise IllegalObjectIdError(object_id, 'object_id may not start with /') + if '.cdist' in object_id: + raise IllegalObjectIdError(object_id, 'object_id may not contain \'.cdist\'') self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id