Move most of the 'specialized' runtime functionality to the python runtime subclass

This commit is contained in:
Joshua Harlow
2012-08-17 19:08:19 -07:00
parent 5fbbd572af
commit 03e932365f
9 changed files with 41 additions and 63 deletions

View File

@@ -448,11 +448,6 @@ class PythonInstallComponent(PkgInstallComponent):
####
class ProgramRuntime(component.Component):
def __init__(self, *args, **kargs):
component.Component.__init__(self, *args, **kargs)
self.tracewriter = tr.TraceWriter(self.trace_files['start'], break_if_there=True)
self.tracereader = tr.TraceReader(self.trace_files['start'])
@property
def apps_to_start(self):
return []
@@ -466,6 +461,26 @@ class ProgramRuntime(component.Component):
mp['APP_NAME'] = app_name
return mp
def restart(self):
return 0
def post_start(self):
pass
def pre_start(self):
pass
class EmptyRuntime(ProgramRuntime):
pass
class PythonRuntime(ProgramRuntime):
def __init__(self, *args, **kargs):
ProgramRuntime.__init__(self, *args, **kargs)
self.tracewriter = tr.TraceWriter(self.trace_files['start'], break_if_there=True)
self.tracereader = tr.TraceReader(self.trace_files['start'])
def start(self):
# Anything to start?
am_started = 0
@@ -550,25 +565,6 @@ class ProgramRuntime(component.Component):
details=details))
return statii
def restart(self):
return 0
def post_start(self):
pass
def pre_start(self):
pass
class PythonRuntime(ProgramRuntime):
def __init__(self, *args, **kargs):
ProgramRuntime.__init__(self, *args, **kargs)
class EmptyRuntime(ProgramRuntime):
def __init__(self, *args, **kargs):
ProgramRuntime.__init__(self, *args, **kargs)
####
#### UNINSTALL CLASSES

View File

@@ -145,9 +145,9 @@ class DBInstaller(comp.PkgInstallComponent):
restart_func=self.runtime.restart)
class DBRuntime(comp.EmptyRuntime):
class DBRuntime(comp.ProgramRuntime):
def __init__(self, *args, **kargs):
comp.EmptyRuntime.__init__(self, *args, **kargs)
comp.ProgramRuntime.__init__(self, *args, **kargs)
self.wait_time = max(self.cfg.getint('DEFAULT', 'service_wait_seconds'), 1)
def _get_run_actions(self, act, exception_cls):

View File

@@ -18,20 +18,15 @@ from anvil import components as comp
class GlanceClientUninstaller(comp.PythonUninstallComponent):
def __init__(self, *args, **kargs):
comp.PythonUninstallComponent.__init__(self, *args, **kargs)
pass
class GlanceClientInstaller(comp.PythonInstallComponent):
def __init__(self, *args, **kargs):
comp.PythonInstallComponent.__init__(self, *args, **kargs)
def _filter_pip_requires_line(self, line):
if line.lower().find('keystoneclient') != -1:
return None
return line
class GlanceClientRuntime(comp.EmptyRuntime):
def __init__(self, *args, **kargs):
comp.EmptyRuntime.__init__(self, *args, **kargs)
class GlanceClientRuntime(comp.ProgramRuntime):
pass

View File

@@ -189,10 +189,7 @@ class HorizonInstaller(comp.PythonInstallComponent):
return mp
class HorizonRuntime(comp.EmptyRuntime):
def __init__(self, *args, **kargs):
comp.EmptyRuntime.__init__(self, *args, **kargs)
class HorizonRuntime(comp.ProgramRuntime):
def start(self):
if self.status()[0].status != comp.STATUS_STARTED:
start_cmd = self.distro.get_command('apache', 'start')

View File

@@ -18,15 +18,12 @@ from anvil import components as comp
class KeyStoneClientUninstaller(comp.PythonUninstallComponent):
def __init__(self, *args, **kargs):
comp.PythonUninstallComponent.__init__(self, *args, **kargs)
pass
class KeyStoneClientInstaller(comp.PythonInstallComponent):
def __init__(self, *args, **kargs):
comp.PythonInstallComponent.__init__(self, *args, **kargs)
pass
class KeyStoneClientRuntime(comp.EmptyRuntime):
def __init__(self, *args, **kargs):
comp.EmptyRuntime.__init__(self, *args, **kargs)
class KeyStoneClientRuntime(comp.ProgramRuntime):
pass

View File

@@ -18,15 +18,12 @@ from anvil import components as comp
class NovaClientUninstaller(comp.PythonUninstallComponent):
def __init__(self, *args, **kargs):
comp.PythonUninstallComponent.__init__(self, *args, **kargs)
pass
class NovaClientInstaller(comp.PythonInstallComponent):
def __init__(self, *args, **kargs):
comp.PythonInstallComponent.__init__(self, *args, **kargs)
pass
class NovaClientRuntime(comp.EmptyRuntime):
def __init__(self, *args, **kargs):
comp.EmptyRuntime.__init__(self, *args, **kargs)
class NovaClientRuntime(comp.ProgramRuntime):
pass

View File

@@ -41,7 +41,7 @@ class NoVNCInstaller(comp.PythonInstallComponent):
return {}
class NoVNCRuntime(comp.ProgramRuntime):
class NoVNCRuntime(comp.PythonRuntime):
@property
def apps_to_start(self):
apps = []

View File

@@ -21,14 +21,10 @@ LOG = logging.getLogger(__name__)
class OpenStackClientUninstaller(comp.PythonUninstallComponent):
def __init__(self, *args, **kargs):
comp.PythonUninstallComponent.__init__(self, *args, **kargs)
pass
class OpenStackClientInstaller(comp.PythonInstallComponent):
def __init__(self, *args, **kargs):
comp.PythonInstallComponent.__init__(self, *args, **kargs)
def _filter_pip_requires_line(self, line):
if line.lower().find('keystoneclient') != -1:
return None
@@ -38,6 +34,6 @@ class OpenStackClientInstaller(comp.PythonInstallComponent):
return None
return line
class OpenStackClientRuntime(comp.EmptyRuntime):
def __init__(self, *args, **kargs):
comp.EmptyRuntime.__init__(self, *args, **kargs)
class OpenStackClientRuntime(comp.ProgramRuntime):
pass

View File

@@ -75,9 +75,9 @@ class RabbitInstaller(comp.PkgInstallComponent):
self._setup_pw()
class RabbitRuntime(comp.EmptyRuntime):
class RabbitRuntime(comp.ProgramRuntime):
def __init__(self, *args, **kargs):
comp.EmptyRuntime.__init__(self, *args, **kargs)
comp.ProgramRuntime.__init__(self, *args, **kargs)
self.wait_time = max(self.cfg.getint('DEFAULT', 'service_wait_seconds'), 1)
def start(self):