From: Tony Mack Date: Wed, 4 Mar 2009 17:42:20 +0000 (+0000) Subject: import config, instantiate shell globally X-Git-Tag: sfa-0.9-0@14641~616 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=dc40f6e2c1071d773b2215e8dc281572b99aab35;p=sfa.git import config, instantiate shell globally --- diff --git a/geni/gimport.py b/geni/gimport.py index d37c6f9a..45dbb444 100755 --- a/geni/gimport.py +++ b/geni/gimport.py @@ -22,8 +22,18 @@ from geni.util.hierarchy import * from geni.util.record import * from geni.util.genitable import * from geni.util.misc import * +from geni.util.config import * -shell = None +# get PL account settings from config module +pl_auth = get_pl_auth() + +# connect to planetlab +if "Url" in pl_auth: + from geni.util import remoteshell + shell = remoteshell.RemoteShell() +else: + import PLC.Shell + shell = PLC.Shell.Shell(globals = globals()) ## # Two authorities are specified: the root authority and the level1 authority. @@ -33,8 +43,8 @@ level1_auth = None #root_auth = "planetlab" #level1_auth = "planetlab.us" - -keyconvert_fn = "../keyconvert/keyconvert" +config = Config() +keyconvert_fn = config.GENI_BASE_DIR + os.sep + "keyconvert/keyconvert" def un_unicode(str): @@ -83,6 +93,8 @@ def connect_shell(): import PLC.Shell shell = PLC.Shell.Shell(globals = globals()) + return shell + def get_auth_table(auth_name): AuthHierarchy = Hierarchy() auth_info = AuthHierarchy.get_auth_info(auth_name)