git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sfaprotocol is renamed into sfaserverproxy, with class SfaServerProxy
[sfa.git]
/
sfa
/
server
/
sfa_component_setup.py
diff --git
a/sfa/server/sfa_component_setup.py
b/sfa/server/sfa_component_setup.py
index
db1c965
..
589a572
100755
(executable)
--- a/
sfa/server/sfa_component_setup.py
+++ b/
sfa/server/sfa_component_setup.py
@@
-3,10
+3,12
@@
import sys
import os
import tempfile
from optparse import OptionParser
import os
import tempfile
from optparse import OptionParser
+
+from sfa.util.faults import ConnectionKeyGIDMismatch
from sfa.util.config import Config
from sfa.util.config import Config
-import sfa.util.xmlrpcprotocol as xmlrpcprotocol
-from sfa.util.
namespace import *
-from sfa.util.faults import *
+from sfa.client.sfaserverproxy import SfaServerProxy
+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.certificate import Keypair, Certificate
from sfa.trust.credential import Credential
from sfa.trust.gid import GID
@@
-26,7
+28,7
@@
def handle_gid_mismatch_exception(f):
return wrapper
return wrapper
-def
get_server
(url=None, port=None, keyfile=None, certfile=None,verbose=False):
+def
server_proxy
(url=None, port=None, keyfile=None, certfile=None,verbose=False):
"""
returns an xmlrpc connection to the service a the specified
address
"""
returns an xmlrpc connection to the service a the specified
address
@@
-46,7
+48,7
@@
def get_server(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.get_server
(url, keyfile, certfile)
+ server =
SfaServerProxy
(url, keyfile, certfile)
return server
return server
@@
-76,9
+78,9
@@
def clean_key_cred():
os.unlink(f)
# install the new key pair
os.unlink(f)
# install the new key pair
- #
get_c
redential will take care of generating the new keypair
+ #
GetC
redential will take care of generating the new keypair
# and credential
# and credential
-
get_c
redential()
+
GetC
redential()
def get_node_key(registry=None, verbose=False):
def get_node_key(registry=None, verbose=False):
@@
-95,8
+97,8
@@
def get_node_key(registry=None, verbose=False):
cert.sign()
cert.save_to_file(certfile)
cert.sign()
cert.save_to_file(certfile)
- registry =
get_server
(url = registry, keyfile=keyfile, certfile=certfile)
- registry.get_key()
+ registry =
server_proxy
(url = registry, keyfile=keyfile, certfile=certfile)
+ 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):
"""
@@
-111,7
+113,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_c
redential(registry=None, force=False, verbose=False):
+def
GetC
redential(registry=None, force=False, verbose=False):
config = Config()
hierarchy = Hierarchy()
key_dir= hierarchy.basedir
config = Config()
hierarchy = Hierarchy()
key_dir= hierarchy.basedir
@@
-143,7
+145,7
@@
def get_credential(registry=None, force=False, verbose=False):
create_server_keypair(keyfile, certfile, hrn, verbose)
# get credential from registry
create_server_keypair(keyfile, certfile, hrn, verbose)
# get credential from registry
- registry =
get_server
(url=registry, keyfile=keyfile, certfile=certfile)
+ registry =
server_proxy
(url=registry, keyfile=keyfile, certfile=certfile)
cert = Certificate(filename=certfile)
cert_str = cert.save_to_string(save_parents=True)
cred = registry.GetSelfCredential(cert_str, 'node', hrn)
cert = Certificate(filename=certfile)
cert_str = cert.save_to_string(save_parents=True)
cred = registry.GetSelfCredential(cert_str, 'node', hrn)
@@
-167,10
+169,10
@@
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_c
redential(registry=registry, verbose=verbose)
+ cred =
GetC
redential(registry=registry, verbose=verbose)
# make sure server key cert pair exists
create_server_keypair(keyfile=keyfile, certfile=certfile, hrn=hrn, verbose=verbose)
# make sure server key cert pair exists
create_server_keypair(keyfile=keyfile, certfile=certfile, hrn=hrn, verbose=verbose)
- registry =
get_server
(url=registry, keyfile=keyfile, certfile=certfile)
+ registry =
server_proxy
(url=registry, keyfile=keyfile, certfile=certfile)
# get the trusted certs and save them in the right place
if verbose:
print "Getting trusted certs from registry"
# get the trusted certs and save them in the right place
if verbose:
print "Getting trusted certs from registry"
@@
-212,17
+214,18
@@
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_c
redential(registry=registry, verbose=verbose)
+ cred =
GetC
redential(registry=registry, verbose=verbose)
# make sure server key cert pair exists
create_server_keypair(keyfile=keyfile, certfile=certfile, hrn=hrn, verbose=verbose)
# make sure server key cert pair exists
create_server_keypair(keyfile=keyfile, certfile=certfile, hrn=hrn, verbose=verbose)
- registry =
get_server
(url=registry, keyfile=keyfile, certfile=certfile)
+ registry =
server_proxy
(url=registry, keyfile=keyfile, certfile=certfile)
if verbose:
print "Getting current slices on this node"
# get a list of slices on this node
if verbose:
print "Getting current slices on this node"
# get a list of slices on this node
- from sfa.plc.api import ComponentAPI
- api = ComponentAPI()
- xids_tuple = api.nodemanager.GetXIDs()
+ from sfa.generic import Generic
+ generic=Generic.the_flavour()
+ api = generic.make_api(interface='component')
+ xids_tuple = api.driver.nodemanager.GetXIDs()
slices = eval(xids_tuple[1])
slicenames = slices.keys()
slices = eval(xids_tuple[1])
slicenames = slices.keys()