Pep8 and pylint cleanups

This commit is contained in:
Joshua Harlow
2012-12-05 18:30:20 -08:00
parent 8974bb916c
commit d9dae04091
3 changed files with 14 additions and 24 deletions

View File

@@ -16,7 +16,6 @@
from anvil import colorizer from anvil import colorizer
from anvil import components as comp from anvil import components as comp
from anvil import exceptions as excp
from anvil import log as logging from anvil import log as logging
from anvil import shell as sh from anvil import shell as sh
from anvil import utils from anvil import utils

View File

@@ -21,11 +21,6 @@ from anvil import shell as sh
UTIL_DIR = 'utils' UTIL_DIR = 'utils'
VNC_PROXY_APP = 'nova-novncproxy' VNC_PROXY_APP = 'nova-novncproxy'
APP_OPTIONS = {
# This reaches into the nova configuration file
# TODO(harlowja) can we stop that?
VNC_PROXY_APP: ['--config-file', '$NOVA_CONF', '--web', '.'],
}
class NoVNCUninstaller(comp.PythonUninstallComponent): class NoVNCUninstaller(comp.PythonUninstallComponent):
@@ -35,27 +30,24 @@ class NoVNCUninstaller(comp.PythonUninstallComponent):
class NoVNCInstaller(comp.PythonInstallComponent): class NoVNCInstaller(comp.PythonInstallComponent):
@property @property
def python_directories(self): def python_directories(self):
# Its python but not one that we need to run setup.py in...
return {} return {}
class NoVNCRuntime(comp.PythonRuntime): class NoVNCRuntime(comp.PythonRuntime):
@property @property
def applications(self): def applications(self):
apps = [] path = sh.joinpths(self.get_option('app_dir'), UTIL_DIR, VNC_PROXY_APP)
for (name, argv) in APP_OPTIONS.items(): argv = ['--config-file', self._get_nova_conf(), '--web', '.']
path = sh.joinpths(self.get_option('app_dir'), UTIL_DIR, name) return [
if sh.is_executable(path): comp.Program(VNC_PROXY_APP, path, argv=argv),
apps.append(comp.Program(name, path, argv=argv)) ]
return apps
def app_params(self, program): def _get_nova_conf(self):
params = comp.ProgramRuntime.app_params(self, program)
nova_comp_name = self.get_option('nova-component') nova_comp_name = self.get_option('nova-component')
if program.name == VNC_PROXY_APP:
if nova_comp_name in self.instances: if nova_comp_name in self.instances:
# FIXME(harlowja): Have to reach into the nova component to get the config path (puke) # FIXME(harlowja): Have to reach into the nova component to get the config path (puke)
nova_runtime = self.instances[nova_comp_name] nova_runtime = self.instances[nova_comp_name]
params['NOVA_CONF'] = nova_runtime.config_path return nova_runtime.config_path
else: else:
raise RuntimeError("NoVNC can not be started without the location of the nova configuration file") raise RuntimeError("NoVNC can not be started without the location of the nova configuration file")
return params

View File

@@ -31,7 +31,6 @@ import psutil # http://code.google.com/p/psutil/wiki/Documentation
from anvil import env from anvil import env
from anvil import exceptions as excp from anvil import exceptions as excp
from anvil import log as logging from anvil import log as logging
from anvil import type_utils as tu
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)