X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=pl_mom.py;h=96cde639a81c7256aea8340d5a95a2911f0c06f0;hb=e6bf42e01d13eb8dd98eb61f0a82966363f11a68;hp=36be37adcafecf1ee6f23c31a222e4daa2d6dac2;hpb=0fa27e7f8d24222798cfa106de73d539ecd1be16;p=mom.git diff --git a/pl_mom.py b/pl_mom.py index 36be37a..96cde63 100644 --- a/pl_mom.py +++ b/pl_mom.py @@ -5,7 +5,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: pl_mom.py,v 1.3 2006/05/09 03:22:25 mlhuang Exp $ +# $Id: pl_mom.py,v 1.4 2006/06/02 04:00:00 mlhuang Exp $ # import os @@ -184,10 +184,10 @@ class NM: Get values of various slice attributes from the local Node Manager slice - slice name - attributes - [attribute_name, (attribute_name, return_value_if_not_set), ...] + attributes - [(attribute_name, return_value_if_not_set), ...] """ - values = [None for attribute in attributes] + values = [attribute[1] for attribute in attributes] if self.nm is not None: try: @@ -196,18 +196,10 @@ class NM: rspec = rcap.readline().strip() rcap.close() - for i, attribute in enumerate(attributes): - # NM interface allows you to pass in a tuple - # (attribute, default) instead of just an - # attribute name. default is returned if the - # attribute is not set. - if type(attribute) != tuple: - attribute = (attribute, 0) - (rc, (value,)) = self.nm.nm_inspect(rspec, [attribute]) - if rc == 0 and value != attribute[1]: - values[i] = value + (rc, result) = self.nm.nm_inspect(rspec, attributes) + if rc == 0 and type(result) == list and len(result) == len(values): + values = result except Exception, err: print "Warning: Exception received while querying Node Manager:", err - self.nm = None return values