##
from sfa.util.sfalogging import _SfaLogger
-
-from sfa.util.record import SfaRecord
-from sfa.util.table import SfaTable
from sfa.util.xrn import get_authority, hrn_to_urn
from sfa.util.plxrn import email_to_hrn
from sfa.util.config import Config
+
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.storage.record import SfaRecord
+from sfa.storage.table import SfaTable
+
def _un_unicode(str):
if isinstance(str, unicode):
self.AuthHierarchy = Hierarchy()
self.config = Config()
self.TrustedRoots = TrustedRoots(Config.get_trustedroots_dir(self.config))
- self.plc_auth = self.config.get_plc_auth()
self.root_auth = self.config.SFA_REGISTRY_ROOT_AUTH
- # connect to planetlab
- self.shell = None
- if "Url" in self.plc_auth:
- from sfa.plc.remoteshell import RemoteShell
- self.shell = RemoteShell(self.logger)
- else:
- import PLC.Shell
- self.shell = PLC.Shell.Shell(globals = globals())
+ # should use a driver instead...
+ from sfa.plc.plshell import PlShell
+ # how to connect to planetlab
+ self.shell = PlShell (self.config)
def create_top_level_auth_records(self, hrn):
"""
- Create top level records (includes root and sub authorities (local/remote)
+ Create top level db records (includes root and sub authorities (local/remote)
"""
- urn = hrn_to_urn(hrn, 'authority')
# make sure parent exists
parent_hrn = get_authority(hrn)
if not parent_hrn:
if not parent_hrn == hrn:
self.create_top_level_auth_records(parent_hrn)
- # create the authority if it doesnt already exist
- if not self.AuthHierarchy.auth_exists(urn):
- self.logger.info("Import: creating top level authorities")
- self.AuthHierarchy.create_auth(urn)
-
+ # enxure key and cert exists:
+ self.AuthHierarchy.create_top_level_auth(hrn)
# create the db record if it doesnt already exist
auth_info = self.AuthHierarchy.get_auth_info(hrn)
table = SfaTable()
key_ids = person["key_ids"]
# get the user's private key from the SSH keys they have uploaded
# to planetlab
- keys = self.shell.GetKeys(self.plc_auth, key_ids)
+ keys = self.shell.GetKeys(key_ids)
key = keys[0]['key']
pkey = None
try: