From: Andrew Gaffney Date: Thu, 6 Sep 2007 21:30:15 +0000 (+0000) Subject: raise an exception in parse_spec() if there's a duplicate key in the spec X-Git-Tag: CATALYST_2_0_6_916~250 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=426b7df24dd802963e27d0d18fe7f5710e4c0186;p=catalyst.git raise an exception in parse_spec() if there's a duplicate key in the spec git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1244 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index 474b8803..15ff628e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 # $Id: $ + 06 Sep 2007; Andrew Gaffney + modules/catalyst_support.py: + raise an exception in parse_spec() if there's a duplicate key in the spec + 06 Sep 2007; Andrew Gaffney examples/netboot_template.spec, examples/tinderbox_template.spec, modules/grp_target.py, modules/tinderbox_target.py: diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py index 7d0cbf9a..6943cfed 100644 --- a/modules/catalyst_support.py +++ b/modules/catalyst_support.py @@ -563,6 +563,11 @@ def parse_spec(mylines): # Split on the first semicolon creating two strings in the array mobjs mobjs = myline.split(':', 1) mobjs[1] = mobjs[1].strip() + + # Check that this key doesn't exist already in the spec + if myspec.has_key(mobjs[0]): + raise Exception("You have a duplicate key (" + mobjs[0] + ") in your spec. Please fix it") + # Start a new array using the first element of mobjs cur_array = [mobjs[0]] if mobjs[1]: