From a06220a9ecd2dc65ede9eeb5d787f1f6c446be17 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 13 Feb 2012 17:53:14 -0800 Subject: [PATCH] Some cleanups around imports and making written scripts executable. --- devstack/components/db.py | 4 ++-- devstack/components/horizon.py | 8 +++++--- devstack/components/keystone.py | 7 +++++-- devstack/components/nova.py | 1 + devstack/components/swift.py | 4 ---- devstack/log.py | 7 +++---- tools/validate_json.py | 2 +- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/devstack/components/db.py b/devstack/components/db.py index ca4ad826..af0e0e0e 100644 --- a/devstack/components/db.py +++ b/devstack/components/db.py @@ -14,6 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. +import time + from devstack import component as comp from devstack import exceptions as excp from devstack import log as logging @@ -22,8 +24,6 @@ from devstack import shell as sh from devstack import trace as tr from devstack import utils -import time - #id TYPE = settings.DB LOG = logging.getLogger("devstack.components.db") diff --git a/devstack/components/horizon.py b/devstack/components/horizon.py index 72c26c81..677fb27d 100644 --- a/devstack/components/horizon.py +++ b/devstack/components/horizon.py @@ -27,24 +27,26 @@ LOG = logging.getLogger("devstack.components.horizon") #actual dir names ROOT_HORIZON = 'horizon' -HORIZON_NAME = 'horizon' ROOT_DASH = 'openstack-dashboard' + +#name used for python install trace +HORIZON_NAME = ROOT_HORIZON DASH_NAME = 'dashboard' #config files messed with HORIZON_PY_CONF = "horizon_settings.py" HORIZON_PY_CONF_TGT = ['local', 'local_settings.py'] HORIZON_APACHE_CONF = '000-default' +CONFIGS = [HORIZON_PY_CONF, HORIZON_APACHE_CONF] #http://wiki.apache.org/httpd/DistrosDefaultLayout #TODO: maybe this should be a subclass that handles these differences APACHE_CONF_TARGETS = { settings.UBUNTU11: '/etc/apache2/sites-enabled/000-default', - #ensure runs after wsgi.conf + #ensure runs after wsgi.conf (naming wise) settings.RHEL6: '/etc/httpd/conf.d/wsgi-horizon-000-default.conf', settings.FEDORA16: '/etc/httpd/conf.d/wsgi-horizon-000-default.conf', } -CONFIGS = [HORIZON_PY_CONF, HORIZON_APACHE_CONF] #db sync that needs to happen for horizon DB_SYNC_CMD = ['python', 'manage.py', 'syncdb'] diff --git a/devstack/components/keystone.py b/devstack/components/keystone.py index d3248717..cdac625a 100644 --- a/devstack/components/keystone.py +++ b/devstack/components/keystone.py @@ -121,13 +121,16 @@ class KeystoneInstaller(comp.PythonInstallComponent): def _setup_data(self): LOG.info("Configuring data setup template %s.", MANAGE_DATA_CONF) + #first write it (_, contents) = utils.load_template(self.component_name, MANAGE_DATA_CONF) params = self._get_param_map(MANAGE_DATA_CONF) contents = utils.param_replace(contents, params, True) tgt_fn = sh.joinpths(self.bindir, MANAGE_DATA_CONF) sh.write_file(tgt_fn, contents) - # This environment additions are important - # in that they eventually affect how this script runs + sh.chmod(tgt_fn, 755) + #now run it + #these environment additions are important + #in that they eventually affect how this script runs env = dict() env['ENABLED_SERVICES'] = ",".join(self.instances.keys()) env['BIN_DIR'] = self.bindir diff --git a/devstack/components/nova.py b/devstack/components/nova.py index 25a7474c..84e3b6dd 100644 --- a/devstack/components/nova.py +++ b/devstack/components/nova.py @@ -298,6 +298,7 @@ class NovaInstaller(comp.PythonInstallComponent): (_, contents) = utils.load_template(self.component_name, CLEANER_DATA_CONF) tgt_fn = sh.joinpths(self.bindir, CLEANER_DATA_CONF) sh.write_file(tgt_fn, contents) + sh.chmod(tgt_fn, 755) self.tracewriter.file_touched(tgt_fn) def _setup_db(self): diff --git a/devstack/components/swift.py b/devstack/components/swift.py index 7ddf9eb0..638590b3 100644 --- a/devstack/components/swift.py +++ b/devstack/components/swift.py @@ -44,10 +44,6 @@ CONFIGS = [SWIFT_CONF, PROXY_SERVER_CONF, ACCOUNT_SERVER_CONF, BIN_DIR = 'bin' CONFIG_DIR = 'etc' -# what to start -APP_OPTIONS = { -} - #the pkg json files swift requires for installation REQ_PKGS = ['general.json', 'swift.json'] diff --git a/devstack/log.py b/devstack/log.py index 5137c2ee..68eb8706 100644 --- a/devstack/log.py +++ b/devstack/log.py @@ -22,6 +22,9 @@ import sys #but the colors make it worth it :-) from termcolor import colored +# methods +getLogger = logging.getLogger + class TermFormatter(logging.Formatter): def __init__(self, reg_fmt, date_format): @@ -59,7 +62,3 @@ class TermHandler(logging.Handler): TermHandler.STREAM.write(msg + TermHandler.NL) if TermHandler.DO_FLUSH: TermHandler.STREAM.flush() - - -def getLogger(name): - return logging.getLogger(name) diff --git a/tools/validate_json.py b/tools/validate_json.py index 7dbfe6f9..dfd6a728 100644 --- a/tools/validate_json.py +++ b/tools/validate_json.py @@ -10,7 +10,7 @@ import json import logging import optparse import os -import re +import re # Configure logging