make sync won't work onto debian-based deployments (diff. layout)
[sfa.git] / sfa / server / sfa_component_setup.py
index 16f358e..f75f1ca 100755 (executable)
@@ -6,14 +6,16 @@ from optparse import OptionParser
 
 from sfa.util.faults import ConnectionKeyGIDMismatch
 from sfa.util.config import Config
 
 from sfa.util.faults import ConnectionKeyGIDMismatch
 from sfa.util.config import Config
-import sfa.client.xmlrpcprotocol as xmlrpcprotocol
-from sfa.util.plxrn import hrn_to_pl_slicename, slicename_to_hrn
 
 from sfa.trust.certificate import Keypair, Certificate
 from sfa.trust.credential import Credential
 from sfa.trust.gid import GID
 from sfa.trust.hierarchy import Hierarchy
 
 
 from sfa.trust.certificate import Keypair, Certificate
 from sfa.trust.credential import Credential
 from sfa.trust.gid import GID
 from sfa.trust.hierarchy import Hierarchy
 
+from sfa.client.sfaserverproxy import SfaServerProxy
+
+from sfa.planetlab.plxrn import hrn_to_pl_slicename, slicename_to_hrn
+
 KEYDIR = "/var/lib/sfa/"
 CONFDIR = "/etc/sfa/"
 
 KEYDIR = "/var/lib/sfa/"
 CONFDIR = "/etc/sfa/"
 
@@ -48,7 +50,7 @@ def server_proxy(url=None, port=None, keyfile=None, certfile=None,verbose=False)
     if verbose:
         print "Contacting registry at: %(url)s" % locals()
 
     if verbose:
         print "Contacting registry at: %(url)s" % locals()
 
-    server = xmlrpcprotocol.server_proxy(url, keyfile, certfile)
+    server = SfaServerProxy(url, keyfile, certfile)
     return server    
     
 
     return server    
     
 
@@ -78,9 +80,9 @@ def clean_key_cred():
             os.unlink(f)
    
     # install the new key pair
             os.unlink(f)
    
     # install the new key pair
-    # get_credential will take care of generating the new keypair
+    # GetCredential will take care of generating the new keypair
     # and credential 
     # and credential 
-    get_credential()
+    GetCredential()
     
              
 def get_node_key(registry=None, verbose=False):
     
              
 def get_node_key(registry=None, verbose=False):
@@ -98,7 +100,7 @@ def get_node_key(registry=None, verbose=False):
     cert.save_to_file(certfile)
     
     registry = server_proxy(url = registry, keyfile=keyfile, certfile=certfile)    
     cert.save_to_file(certfile)
     
     registry = server_proxy(url = registry, keyfile=keyfile, certfile=certfile)    
-    registry.get_key()
+    registry.get_key_from_incoming_ip()
 
 def create_server_keypair(keyfile=None, certfile=None, hrn="component", verbose=False):
     """
 
 def create_server_keypair(keyfile=None, certfile=None, hrn="component", verbose=False):
     """
@@ -113,7 +115,7 @@ def create_server_keypair(keyfile=None, certfile=None, hrn="component", verbose=
     cert.save_to_file(certfile, save_parents=True)       
 
 @handle_gid_mismatch_exception
     cert.save_to_file(certfile, save_parents=True)       
 
 @handle_gid_mismatch_exception
-def get_credential(registry=None, force=False, verbose=False):
+def GetCredential(registry=None, force=False, verbose=False):
     config = Config()
     hierarchy = Hierarchy()
     key_dir= hierarchy.basedir
     config = Config()
     hierarchy = Hierarchy()
     key_dir= hierarchy.basedir
@@ -169,7 +171,7 @@ def get_trusted_certs(registry=None, verbose=False):
     node_gid = GID(filename=node_gid_file)
     hrn = node_gid.get_hrn()
     # get credential
     node_gid = GID(filename=node_gid_file)
     hrn = node_gid.get_hrn()
     # get credential
-    cred = get_credential(registry=registry, verbose=verbose)
+    cred = GetCredential(registry=registry, verbose=verbose)
     # make sure server key cert pair exists
     create_server_keypair(keyfile=keyfile, certfile=certfile, hrn=hrn, verbose=verbose)
     registry = server_proxy(url=registry, keyfile=keyfile, certfile=certfile)
     # make sure server key cert pair exists
     create_server_keypair(keyfile=keyfile, certfile=certfile, hrn=hrn, verbose=verbose)
     registry = server_proxy(url=registry, keyfile=keyfile, certfile=certfile)
@@ -214,7 +216,7 @@ def get_gids(registry=None, verbose=False):
     hrn = node_gid.get_hrn()
     interface_hrn = config.SFA_INTERFACE_HRN
     # get credential
     hrn = node_gid.get_hrn()
     interface_hrn = config.SFA_INTERFACE_HRN
     # get credential
-    cred = get_credential(registry=registry, verbose=verbose)
+    cred = GetCredential(registry=registry, verbose=verbose)
     # make sure server key cert pair exists
     create_server_keypair(keyfile=keyfile, certfile=certfile, hrn=hrn, verbose=verbose)
     registry = server_proxy(url=registry, keyfile=keyfile, certfile=certfile)
     # make sure server key cert pair exists
     create_server_keypair(keyfile=keyfile, certfile=certfile, hrn=hrn, verbose=verbose)
     registry = server_proxy(url=registry, keyfile=keyfile, certfile=certfile)