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
merge master again (2.0-10 changelog only)
[sfa.git]
/
sfa
/
importer
/
sfaImport.py
diff --git
a/sfa/importer/sfaImport.py
b/sfa/importer/sfaImport.py
index
dbcb66d
..
e2101fc
100644
(file)
--- a/
sfa/importer/sfaImport.py
+++ b/
sfa/importer/sfaImport.py
@@
-16,8
+16,7
@@
from sfa.trust.certificate import convert_public_key, Keypair
from sfa.trust.trustedroots import TrustedRoots
from sfa.trust.hierarchy import Hierarchy
from sfa.trust.gid import create_uuid
from sfa.trust.trustedroots import TrustedRoots
from sfa.trust.hierarchy import Hierarchy
from sfa.trust.gid import create_uuid
-from sfa.storage.persistentobjs import RegRecord, RegAuthority, RegUser
-from sfa.storage.persistentobjs import RegTmpAuthSa, RegTmpAuthAm, RegTmpAuthSm
+from sfa.storage.model import RegRecord, RegAuthority, RegUser
from sfa.storage.alchemy import dbsession
def _un_unicode(str):
from sfa.storage.alchemy import dbsession
def _un_unicode(str):
@@
-67,7
+66,9
@@
class sfaImport:
# create interface records
self.logger.info("Import: creating interface records")
# xxx authority+ turning off the creation of authority+*
# create interface records
self.logger.info("Import: creating interface records")
# xxx authority+ turning off the creation of authority+*
-# self.create_interface_records()
+# in fact his is required - used in SfaApi._getCredentialRaw
+# that tries to locate 'authority+sa'
+ self.create_interface_records()
# add local root authority's cert to trusted list
self.logger.info("Import: adding " + interface_hrn + " to trusted list")
# add local root authority's cert to trusted list
self.logger.info("Import: adding " + interface_hrn + " to trusted list")
@@
-90,6
+91,7
@@
class sfaImport:
# create the db record if it doesnt already exist
auth_info = self.AuthHierarchy.get_auth_info(hrn)
auth_record = RegAuthority()
# create the db record if it doesnt already exist
auth_info = self.AuthHierarchy.get_auth_info(hrn)
auth_record = RegAuthority()
+ auth_record.type='authority'
auth_record.hrn=hrn
auth_record.gid=auth_info.get_gid_object()
auth_record.authority=get_authority(hrn)
auth_record.hrn=hrn
auth_record.gid=auth_info.get_gid_object()
auth_record.authority=get_authority(hrn)
@@
-110,6
+112,7
@@
class sfaImport:
auth_info = self.AuthHierarchy.get_auth_info(hrn)
user_record = RegUser()
auth_info = self.AuthHierarchy.get_auth_info(hrn)
user_record = RegUser()
+ user_record.type='user'
user_record.hrn=hrn
user_record.gid=auth_info.get_gid_object()
user_record.authority=get_authority(hrn)
user_record.hrn=hrn
user_record.gid=auth_info.get_gid_object()
user_record.authority=get_authority(hrn)
@@
-118,34
+121,29
@@
class sfaImport:
dbsession.commit()
self.logger.info("Import: importing user (slicemanager) %s " % user_record)
dbsession.commit()
self.logger.info("Import: importing user (slicemanager) %s " % user_record)
-# xxx authority+ - this is currently turned off
def create_interface_records(self):
"""
Create a record for each SFA interface
"""
# just create certs for all sfa interfaces even if they
def create_interface_records(self):
"""
Create a record for each SFA interface
"""
# just create certs for all sfa interfaces even if they
- # arent enabled
+ # aren
'
t enabled
hrn = self.config.SFA_INTERFACE_HRN
hrn = self.config.SFA_INTERFACE_HRN
- reg_classes_info = [ (RegTmpAuthSa, 'authority+sa'),
- (RegTmpAuthAm, 'authority+am'),
- (RegTmpAuthSm, 'authority+sm'), ]
- # interfaces = ['authority+sa', 'authority+am', 'authority+sm']
auth_info = self.AuthHierarchy.get_auth_info(hrn)
pkey = auth_info.get_pkey_object()
auth_info = self.AuthHierarchy.get_auth_info(hrn)
pkey = auth_info.get_pkey_object()
- for
(reg_class, interface) in reg_classes_info
:
- urn = hrn_to_urn(hrn,
interfac
e)
+ for
type in [ 'authority+sa', 'authority+am', 'authority+sm', ]
:
+ urn = hrn_to_urn(hrn,
typ
e)
gid = self.AuthHierarchy.create_gid(urn, create_uuid(), pkey)
# xxx this should probably use a RegAuthority, or a to-be-defined RegPeer object
# but for now we have to preserve the authority+<> stuff
gid = self.AuthHierarchy.create_gid(urn, create_uuid(), pkey)
# xxx this should probably use a RegAuthority, or a to-be-defined RegPeer object
# but for now we have to preserve the authority+<> stuff
- interface_record =
reg_class
()
- #interface_record = RegAuthority()
+ interface_record =
RegAuthority
()
+ interface_record.type=type
interface_record.hrn=hrn
interface_record.gid= gid
interface_record.authority=get_authority(hrn)
interface_record.just_created()
dbsession.add (interface_record)
dbsession.commit()
interface_record.hrn=hrn
interface_record.gid= gid
interface_record.authority=get_authority(hrn)
interface_record.just_created()
dbsession.add (interface_record)
dbsession.commit()
- self.logger.info("Import: imported authority (%s) %s " % (
interfac
e,interface_record))
+ self.logger.info("Import: imported authority (%s) %s " % (
typ
e,interface_record))
def delete_record(self, hrn, type):
# delete the record
def delete_record(self, hrn, type):
# delete the record