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): 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 @property
def apps_to_start(self): def apps_to_start(self):
return [] return []
@@ -466,6 +461,26 @@ class ProgramRuntime(component.Component):
mp['APP_NAME'] = app_name mp['APP_NAME'] = app_name
return mp 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): def start(self):
# Anything to start? # Anything to start?
am_started = 0 am_started = 0
@@ -550,25 +565,6 @@ class ProgramRuntime(component.Component):
details=details)) details=details))
return statii 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 #### UNINSTALL CLASSES

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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