def copy_vessel(longname, newvesselname): newhandle = fastnmclient.nmclient_duplicatehandle( seash_global_variables.vesselinfo[longname]['handle']) newlongname = seash_global_variables.vesselinfo[longname][ 'IP'] + ":" + str(seash_global_variables.vesselinfo[longname] ['port']) + ":" + newvesselname add_vessel(newlongname, seash_global_variables.vesselinfo[longname]['keyname'], newhandle) return newlongname
def copy_vessel(longname, newvesselname): newhandle = fastnmclient.nmclient_duplicatehandle(seash_global_variables.vesselinfo[longname]["handle"]) newlongname = ( seash_global_variables.vesselinfo[longname]["IP"] + ":" + str(seash_global_variables.vesselinfo[longname]["port"]) + ":" + newvesselname ) add_vessel(newlongname, seash_global_variables.vesselinfo[longname]["keyname"], newhandle) return newlongname
def copy_vessel(longname, newvesselname): newhandle = fastnmclient.nmclient_duplicatehandle(seash_global_variables.vesselinfo[longname]['handle']) newlongname = seash_global_variables.vesselinfo[longname]['IP']+":"+str(seash_global_variables.vesselinfo[longname]['port'])+":"+newvesselname add_vessel(newlongname,seash_global_variables.vesselinfo[longname]['keyname'],newhandle) return newlongname
try: # need to contact the node to get the list of vessels we can perform # actions on... ownervessels, uservessels = fastnmclient.nmclient_listaccessiblevessels(nodehandle,seash_global_variables.keys[currentkeyname]['publickey']) retlist = [] # we should add anything we can access (whether a user or owner vessel) for vesselname in ownervessels + uservessels: longname = host+":"+str(port)+":"+vesselname # if we haven't discovered the vessel previously... if longname not in seash_global_variables.targets: # set the vesselname in the handle newhandle = fastnmclient.nmclient_duplicatehandle(nodehandle) handleinfo = fastnmclient.nmclient_get_handle_info(newhandle) handleinfo['vesselname'] = vesselname fastnmclient.nmclient_set_handle_info(newhandle, handleinfo) # then add the vessel to the target list, etc. # add_vessel has no race conditions as long as longname is unique # (and it should be unique) id = add_vessel(longname,currentkeyname,newhandle) seash_global_variables.targets[targetgroup].append(longname) # and append some information to be printed... retlist.append('%'+str(id)+"("+longname+")")
# need to contact the node to get the list of vessels we can perform # actions on... ownervessels, uservessels = fastnmclient.nmclient_listaccessiblevessels( nodehandle, seash_global_variables.keys[currentkeyname]['publickey']) retlist = [] # we should add anything we can access (whether a user or owner vessel) for vesselname in ownervessels + uservessels: longname = host + ":" + str(port) + ":" + vesselname # if we haven't discovered the vessel previously... if longname not in seash_global_variables.targets: # set the vesselname in the handle newhandle = fastnmclient.nmclient_duplicatehandle(nodehandle) handleinfo = fastnmclient.nmclient_get_handle_info(newhandle) handleinfo['vesselname'] = vesselname fastnmclient.nmclient_set_handle_info(newhandle, handleinfo) # then add the vessel to the target list, etc. # add_vessel has no race conditions as long as longname is unique # (and it should be unique) id = add_vessel(longname, currentkeyname, newhandle) seash_global_variables.targets[targetgroup].append(longname) # and append some information to be printed... retlist.append('%' + str(id) + "(" + longname + ")") finally: fastnmclient.nmclient_destroyhandle(nodehandle)