Changeset 3279

Show
Ignore:
Timestamp:
12/14/09 18:21:13 (10 years ago)
Author:
jsamuel
Message:

In the experimentlib, allow using browse_node() without an identity.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • seattle/trunk/experimentmanager/experimentlib.py

    r3274 r3279  
    421421  if nodelocation not in _nmhandle_cache[identitystring]: 
    422422    try: 
    423       if 'privatekey_dict' in identity: 
     423      if identity is None: 
     424        nmhandle = nmclient.nmclient_createhandle(host, port, timeout=defaulttimeout) 
     425      elif 'privatekey_dict' in identity: 
    424426        nmhandle = nmclient.nmclient_createhandle(host, port, privatekey=identity['privatekey_dict'], 
    425427                                           publickey=identity['publickey_dict'], timeout=defaulttimeout) 
     
    687689 
    688690 
    689 def browse_node(nodelocation, identity): 
     691def browse_node(nodelocation, identity=None): 
    690692  """ 
    691693  <Purpose> 
     
    696698      The nodelocation of the node that should be browsed.  
    697699    identity 
    698       The identity whose vessels we are interested in. This can be the identity 
    699       of either the vessel owner or a vessel user. 
     700      (optional) The identity whose vessels we are interested in. This can be 
     701      the identity of either the vessel owner or a vessel user. If None, 
     702      then the vesseldicts for all vessels on the node will be returned. 
    700703  <Exceptions> 
    701704    NodeCommunicationError 
     
    714717  try: 
    715718    _validate_nodelocation(nodelocation) 
    716     _validate_identity(identity) 
     719    if identity is not None: 
     720      _validate_identity(identity) 
    717721     
    718722    nmhandle = _get_nmhandle(nodelocation, identity) 
     
    727731    usablevessels = [] 
    728732    for vesselname in nodeinfo['vessels']: 
    729       if identity['publickey_dict'] == nodeinfo['vessels'][vesselname]['ownerkey']: 
     733      if identity is None: 
     734        usablevessels.append(vesselname) 
     735      elif identity['publickey_dict'] == nodeinfo['vessels'][vesselname]['ownerkey']: 
    730736        usablevessels.append(vesselname) 
    731737      elif 'userkeys' in nodeinfo['vessels'][vesselname] and \