From af62623c6eb3c3f6b8fab839ddce4dc06a616c99 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Wed, 11 Mar 2009 16:16:10 +0000 Subject: [PATCH] xml data can either be an attribute in a element tag or many text nodes (this represents a list/array of values). Support both --- geni/aggregate.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 -- 2.45.2