From: Thierry Parmentelat Date: Fri, 3 Jul 2009 11:20:33 +0000 (+0000) Subject: remove duplicate code X-Git-Tag: sfa-0.9-0@14641~190 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=42b06ddc4d8f7c63b407f27ac8e7ff455cb03b1f;p=sfa.git remove duplicate code --- diff --git a/geni/sfa-import-plc.py b/geni/sfa-import-plc.py index 1823426b..9a47932b 100755 --- a/geni/sfa-import-plc.py +++ b/geni/sfa-import-plc.py @@ -32,13 +32,24 @@ from geni.util.config import * # get PL account settings from config module pl_auth = get_pl_auth() +def connect_shell(): + global pl_auth, shell + + # 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()) + + return shell + # 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()) +shell = connect_shell() ## # Two authorities are specified: the root authority and the level1 authority. @@ -87,22 +98,6 @@ def process_options(): name = opt[0] val = opt[1] -def connect_shell(): - global pl_auth, shell - - # 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()) - - return shell - def get_auth_table(auth_name): AuthHierarchy = Hierarchy() auth_info = AuthHierarchy.get_auth_info(auth_name)