git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d373407
)
we will make our own geniclient connection to the registry instead of using sfa.serve...
author
Tony Mack
<tmack@cs.princeton.edu>
Fri, 11 Sep 2009 20:21:43 +0000
(20:21 +0000)
committer
Tony Mack
<tmack@cs.princeton.edu>
Fri, 11 Sep 2009 20:21:43 +0000
(20:21 +0000)
PLC/SFA.py
patch
|
blob
|
history
diff --git
a/PLC/SFA.py
b/PLC/SFA.py
index
883f570
..
853f238
100644
(file)
--- a/
PLC/SFA.py
+++ b/
PLC/SFA.py
@@
-3,6
+3,9
@@
from types import StringTypes
from PLC.Sites import Sites
try:
from sfa.plc.api import GeniAPI
from PLC.Sites import Sites
try:
from sfa.plc.api import GeniAPI
+ from sfa.util.geniclient import *
+ from sfa.util.config import *
+ from sfa.trust.credential import *
from sfa.plc.sfaImport import cleanup_string
from sfa.server.registry import Registries
from sfa.util.record import *
from sfa.plc.sfaImport import cleanup_string
from sfa.server.registry import Registries
from sfa.util.record import *
@@
-45,13
+48,14
@@
class SFA:
# get a connection to our local sfa registry
# and a valid credential
# get a connection to our local sfa registry
# and a valid credential
+ config = Config()
+ self.authority = config.SFA_INTERFACE_HRN
+ url = 'http://%s:%s/' %(config.SFA_REGISTRY_HOST, config.SFA_REGISTRY_PORT)
+ self.registry = GeniCleint(url, key_file, cert_file)
self.sfa_api = GeniAPI(key_file = key_file, cert_file = cert_file)
self.sfa_api = GeniAPI(key_file = key_file, cert_file = cert_file)
- self.sfa_api.interface = "plcapi"
- registries = Registries(self.sfa_api)
- self.registry = registries[self.sfa_api.hrn]
self.credential = self.sfa_api.getCredential()
self.credential = self.sfa_api.getCredential()
- self.authority = self.sfa_api.hrn
-
+ #cred_file = '/etc/sfa/slicemgr.plc.authority.cred'
+ #self.credential = Credential(filename = cred_file)
def get_login_base(self, site_id):
sites = Sites(self.api, [site_id], ['login_base'])
def get_login_base(self, site_id):
sites = Sites(self.api, [site_id], ['login_base'])
@@
-103,11
+107,12
@@
class SFA:
check if the record (hrn and type) already exist in our sfa db
"""
exists = False
check if the record (hrn and type) already exist in our sfa db
"""
exists = False
-
# list is quicker than resolve
parent_hrn = get_authority(hrn)
if not parent_hrn: parent_hrn = hrn
# list is quicker than resolve
parent_hrn = get_authority(hrn)
if not parent_hrn: parent_hrn = hrn
- records = self.registry.list(self.credential, parent_hrn)
+ #records = self.registry.list(self.credential, parent_hrn)
+ records = self.registry.resolve(self.credential, hrn)
+ records = []
for record in records:
if record['type'] == type and record['hrn'] == hrn:
exists = True
for record in records:
if record['type'] == type and record['hrn'] == hrn:
exists = True