From: Tony Mack Date: Wed, 11 Mar 2009 16:16:10 +0000 (+0000) Subject: xml data can either be an attribute in a element tag or many text nodes (this represe... X-Git-Tag: sfa-0.9-0@14641~586 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=af62623c6eb3c3f6b8fab839ddce4dc06a616c99;p=sfa.git xml data can either be an attribute in a element tag or many text nodes (this represents a list/array of values). Support both --- diff --git a/geni/aggregate.py b/geni/aggregate.py index 6c3d930e..7e047e3c 100644 --- a/geni/aggregate.py +++ b/geni/aggregate.py @@ -4,6 +4,7 @@ import datetime import time import xmlrpclib +from types import StringTypes, ListType from geni.util.geniserver import GeniServer from geni.util.geniclient import * from geni.util.cert import Keypair, Certificate @@ -343,13 +344,18 @@ class Aggregate(GeniServer): slice = slices[0] # find out where this slice is currently running - nodes = self.shell.GetNodes(self.auth, slice['node_ids'], ['hostname']) - hostnames = [node['hostname'] for node in nodes] + nodelist = self.shell.GetNodes(self.auth, slice['node_ids'], ['hostname']) + hostnames = [node['hostname'] for node in nodelist] # get netspec details nodespecs = spec.getDictsByTagName('NodeSpec') - nodes = [nodespec['name'] for nodespec in nodespecs] - + nodes = [] + for nodespec in nodespecs: + if isinstance(nodespec['name'], list): + nodes.extend(nodespec['name']) + elif isinstance(nodespec['name'], StringTypes: + nodes.append(nodespec['name']) + # save slice state locally # we can assume that spec object has been validated so its safer to # save this instead of the unvalidated rspec the user gave us