raise an exception in parse_spec() if there's a duplicate key in the spec
authorAndrew Gaffney <agaffney@gentoo.org>
Thu, 6 Sep 2007 21:30:15 +0000 (21:30 +0000)
committerAndrew Gaffney <agaffney@gentoo.org>
Thu, 6 Sep 2007 21:30:15 +0000 (21:30 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1244 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
modules/catalyst_support.py

index 474b8803aa500ea2e36a246d31908fc7758a4258..15ff628eb5d3703d976d73ff5a121390c43fe382 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
 # $Id: $
 
+  06 Sep 2007; Andrew Gaffney <agaffney@gentoo.org>
+  modules/catalyst_support.py:
+  raise an exception in parse_spec() if there's a duplicate key in the spec
+
   06 Sep 2007; Andrew Gaffney <agaffney@gentoo.org>
   examples/netboot_template.spec, examples/tinderbox_template.spec,
   modules/grp_target.py, modules/tinderbox_target.py:
index 7d0cbf9a2291d5a33a371d11a7965cd2be63562b..6943cfeddd2219a268a39e454a555a50089a7e15 100644 (file)
@@ -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]: