summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-10-29 15:13:44 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-10-29 15:13:44 +0000
commite825d589c7cf55c95029d99822e71437fd3a79c6 (patch)
tree5838a55d01ce97fe878aa1e561f1a366bb7aed8a
parentcdca16ba93e874e6fcc736731d379e0bde7a6f88 (diff)
downloadbcfg2-e825d589c7cf55c95029d99822e71437fd3a79c6.tar.gz
bcfg2-e825d589c7cf55c95029d99822e71437fd3a79c6.tar.bz2
bcfg2-e825d589c7cf55c95029d99822e71437fd3a79c6.zip
make hierarchical files work
(Logical change 1.123) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@552 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Server/Structures/Base.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/Server/Structures/Base.py b/src/lib/Server/Structures/Base.py
index 9c6eaf573..16719e424 100644
--- a/src/lib/Server/Structures/Base.py
+++ b/src/lib/Server/Structures/Base.py
@@ -14,14 +14,17 @@ class BaseFile(SingleXMLFileBacked):
def Index(self):
'''Store XML data in reasonable structures'''
- self.store = {}
+ self.store = {'Class':{'all':[]}, 'Image':{'all':[]}, 'all':[]}
for entry in XML(self.data).getchildren():
- self.store[entry.tag][entry.get('name')] = {'all':[], 'Class':{}}
- for child in entry.getchildren():
- if child.tag in ['Image', 'Class']:
- self.store[entry.tag][child.tag][child.get('name')] = child.getchildren()
- else:
- self.store[entry.tag]['all'].append(child)
+ self.store[entry.tag][entry.get('name')] = {'all':[], 'Class':{}, 'Image':{}}
+ if entry.tag in ['Image', 'Class']:
+ for child in entry.getchildren():
+ if child.tag in ['Image', 'Class']:
+ self.store[entry.tag][entry.get('name')][child.tag][child.get('name')] = child.getchildren()
+ else:
+ self.store[entry.tag][entry.get('name')]['all'].append(child)
+ else:
+ self.store[entry.tag]['all'].append(child)
def Construct(self, metadata):
'''Build structures for client described by metadata'''