From d9dae04091a57d561da2723e48cd2fbc5b9644c7 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Wed, 5 Dec 2012 18:30:20 -0800 Subject: [PATCH] Pep8 and pylint cleanups --- anvil/components/db.py | 3 +-- anvil/components/novnc.py | 34 +++++++++++++--------------------- anvil/shell.py | 1 - 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/anvil/components/db.py b/anvil/components/db.py index c8fd10c1..ce17f4e4 100644 --- a/anvil/components/db.py +++ b/anvil/components/db.py @@ -16,7 +16,6 @@ from anvil import colorizer from anvil import components as comp -from anvil import exceptions as excp from anvil import log as logging from anvil import shell as sh from anvil import utils @@ -154,7 +153,7 @@ class DBRuntime(comp.ProgramRuntime): if not cmd: raise NotImplementedError("No distro command provided to perform action %r" % (action)) return sh.execute(*cmd, run_as_root=True, check_exit_code=check_exit_code) - + def start(self): if self.statii()[0].status != comp.STATUS_STARTED: self._run_action('start') diff --git a/anvil/components/novnc.py b/anvil/components/novnc.py index d5a9f251..f2849258 100644 --- a/anvil/components/novnc.py +++ b/anvil/components/novnc.py @@ -21,11 +21,6 @@ from anvil import shell as sh UTIL_DIR = 'utils' 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): @@ -35,27 +30,24 @@ class NoVNCUninstaller(comp.PythonUninstallComponent): class NoVNCInstaller(comp.PythonInstallComponent): @property def python_directories(self): + # Its python but not one that we need to run setup.py in... return {} class NoVNCRuntime(comp.PythonRuntime): @property def applications(self): - apps = [] - for (name, argv) in APP_OPTIONS.items(): - path = sh.joinpths(self.get_option('app_dir'), UTIL_DIR, name) - if sh.is_executable(path): - apps.append(comp.Program(name, path, argv=argv)) - return apps + path = sh.joinpths(self.get_option('app_dir'), UTIL_DIR, VNC_PROXY_APP) + argv = ['--config-file', self._get_nova_conf(), '--web', '.'] + return [ + comp.Program(VNC_PROXY_APP, path, argv=argv), + ] - def app_params(self, program): - params = comp.ProgramRuntime.app_params(self, program) + def _get_nova_conf(self): nova_comp_name = self.get_option('nova-component') - if program.name == VNC_PROXY_APP: - if nova_comp_name in self.instances: - # FIXME(harlowja): Have to reach into the nova component to get the config path (puke) - nova_runtime = self.instances[nova_comp_name] - params['NOVA_CONF'] = nova_runtime.config_path - else: - raise RuntimeError("NoVNC can not be started without the location of the nova configuration file") - return params + if nova_comp_name in self.instances: + # FIXME(harlowja): Have to reach into the nova component to get the config path (puke) + nova_runtime = self.instances[nova_comp_name] + return nova_runtime.config_path + else: + raise RuntimeError("NoVNC can not be started without the location of the nova configuration file") diff --git a/anvil/shell.py b/anvil/shell.py index f354c01b..7cc56f6b 100644 --- a/anvil/shell.py +++ b/anvil/shell.py @@ -31,7 +31,6 @@ import psutil # http://code.google.com/p/psutil/wiki/Documentation from anvil import env from anvil import exceptions as excp from anvil import log as logging -from anvil import type_utils as tu LOG = logging.getLogger(__name__)