From 6c1e0377692ac0a69a763ca592c45567c7515f49 Mon Sep 17 00:00:00 2001
From: Tony Mack <tmack@paris.CS.Princeton.EDU>
Date: Fri, 29 Jun 2012 11:38:10 -0400
Subject: [PATCH] rename NovaShell to Shell. cleanup

---
 sfa/openstack/nova_driver.py |  3 +--
 sfa/openstack/nova_shell.py  | 30 ++++--------------------------
 2 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/sfa/openstack/nova_driver.py b/sfa/openstack/nova_driver.py
index cb34b149..c65ca484 100644
--- a/sfa/openstack/nova_driver.py
+++ b/sfa/openstack/nova_driver.py
@@ -47,8 +47,7 @@ class NovaDriver (Driver):
 
     def __init__ (self, config):
         Driver.__init__ (self, config)
-        self.shell = NovaShell (config)
-        self.euca_shell = EucaShell(config)
+        self.shell = Shell (config)
         self.cache=None
         if config.SFA_AGGREGATE_CACHING:
             if NovaDriver.cache is None:
diff --git a/sfa/openstack/nova_shell.py b/sfa/openstack/nova_shell.py
index c597729b..7fab67f8 100644
--- a/sfa/openstack/nova_shell.py
+++ b/sfa/openstack/nova_shell.py
@@ -7,34 +7,14 @@ from sfa.util.sfalogging import logger
 from sfa.util.config import Config
 
 try:
-    from nova import db
-    from nova import flags
-    from nova import context
-    from nova.auth.manager import AuthManager
-    from nova.compute.manager import ComputeManager
-    from nova.network.manager import NetworkManager
-    from nova.scheduler.manager import SchedulerManager
-    from sfa.openstack.client import GlanceClient, NovaClient
+    from sfa.openstack.client import GlanceClient, NovaClient, KeystoneClient
     has_nova = True
 except:
     has_nova = False
 
 
-class InjectContext:
-    """
-    Wraps the module and injects the context when executing methods 
-    """     
-    def __init__(self, proxy, context):
-        self.proxy = proxy
-        self.context = context
-    
-    def __getattr__(self, name):
-        def func(*args, **kwds):
-            result=getattr(self.proxy, name)(self.context, *args, **kwds)
-            return result
-        return func
 
-class NovaShell:
+class Shell:
     """
     A simple native shell to a nova backend. 
     This class can receive all nova calls to the underlying testbed
@@ -46,14 +26,12 @@ class NovaShell:
 
 
     # use the 'capability' auth mechanism for higher performance when the PLC db is local    
-    def __init__ ( self, config ) :
+    def __init__ ( self, config=None) :
         if not config:
             config = Config()
-        self.image_manager = None
-        self.nova_manager = None
-
         if has_nova:
             # instantiate managers 
+            self.auth_manager = KeystoneClient(config)
             self.image_manager = GlanceClient(config)
             self.nova_manager = NovaClient(config)
         else:
-- 
2.47.0