Example #1
0
def get_handle_from_nodehandle(nodehandle):
  '''
  <Purpose>
    Given a node handle (e.g. 192.168.1.1:1224:v8), figure out its vesselhandle.

  <Parameters>
    nodehandle:
      A string representing a vessel, in the format 'node_id:port:vesselname'

  <Exceptions>
    NMClientException

  <Side Effects>
    Connect to the given node handle.

  <Return>
    The vesselhandle that corresponds with the node handle.

  '''
  nodeid, port, vesselname = nodehandle.split(':')
  port = int(port)
  nmhandle = fastnmclient.nmclient_createhandle(nodeid, port)
  try:
    vesseldict = fastnmclient.nmclient_getvesseldict(nmhandle)
  finally:
    fastnmclient.nmclient_destroyhandle(nmhandle)
  return rsa_publickey_to_string(vesseldict['nodekey']) + ':' + vesselname
Example #2
0
def list_or_update_target(longname):

  vesselname = seash_global_variables.vesselinfo[longname]['vesselname']

  try:
    vesseldict = fastnmclient.nmclient_getvesseldict(seash_global_variables.vesselinfo[longname]['handle'])

  except fastnmclient.NMClientException, e:
    return (False, str(e))
Example #3
0
def list_or_update_target(longname):

    vesselname = seash_global_variables.vesselinfo[longname]['vesselname']

    try:
        vesseldict = fastnmclient.nmclient_getvesseldict(
            seash_global_variables.vesselinfo[longname]['handle'])

    except fastnmclient.NMClientException, e:
        return (False, str(e))
  """
    host, portstring, vesselname = vesselhandle.split(':')
    port = int(portstring)

    # get information about the node's vessels
    try:
        nodehandle = fastnmclient.nmclient_createhandle(
            host, port, timeout=seash_global_variables.globalseashtimeout)

    except fastnmclient.NMClientException, e:
        return (False, str(e))

    try:
        # We need to get the nodekey on this vessel
        vesseldict = fastnmclient.nmclient_getvesseldict(nodehandle)
    except fastnmclient.NMClientException, e:
        return (False, str(e))
    finally:
        fastnmclient.nmclient_destroyhandle(nodehandle)

    nodekeystr = rsa_publickey_to_string(vesseldict['nodekey'])
    return (True, nodekeystr + ':' + vesselname)


def _connect_to_clearinghouse(identity):
    global is_printed_m2crypto_not_installed

    try:
        return seattleclearinghouse_xmlrpc.SeattleClearinghouseClient(
            username=identity,
Example #5
0
  """
  host, portstring, vesselname = vesselhandle.split(':')
  port = int(portstring)

  # get information about the node's vessels
  try:
    nodehandle = fastnmclient.nmclient_createhandle(host, port,
      timeout=seash_global_variables.globalseashtimeout)

  except fastnmclient.NMClientException,e:
    return (False, str(e))

  try:
    # We need to get the nodekey on this vessel
    vesseldict = fastnmclient.nmclient_getvesseldict(nodehandle)
  except fastnmclient.NMClientException,e:
    return (False, str(e))
  finally:
    fastnmclient.nmclient_destroyhandle(nodehandle)

  nodekeystr = rsa_publickey_to_string(vesseldict['nodekey'])
  return (True, nodekeystr+':'+vesselname)


def _connect_to_clearinghouse(identity, allow_ssl_insecure):
  try:
    return seattleclearinghouse_xmlrpc.SeattleClearinghouseClient(
      username=identity,
      private_key_string=rsa_privatekey_to_string(
        seash_global_variables.keys[identity]['privatekey']),