From 42b06ddc4d8f7c63b407f27ac8e7ff455cb03b1f Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 3 Jul 2009 11:20:33 +0000 Subject: [PATCH 1/1] remove duplicate code --- geni/sfa-import-plc.py | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) 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) -- 2.45.2