Some cleanups around imports and making written scripts executable.

This commit is contained in:
Joshua Harlow 2012-02-13 17:53:14 -08:00
parent 6b1ff60ac1
commit a06220a9ec
7 changed files with 17 additions and 16 deletions

View File

@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import time
from devstack import component as comp from devstack import component as comp
from devstack import exceptions as excp from devstack import exceptions as excp
from devstack import log as logging 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 trace as tr
from devstack import utils from devstack import utils
import time
#id #id
TYPE = settings.DB TYPE = settings.DB
LOG = logging.getLogger("devstack.components.db") LOG = logging.getLogger("devstack.components.db")

View File

@ -27,24 +27,26 @@ LOG = logging.getLogger("devstack.components.horizon")
#actual dir names #actual dir names
ROOT_HORIZON = 'horizon' ROOT_HORIZON = 'horizon'
HORIZON_NAME = 'horizon'
ROOT_DASH = 'openstack-dashboard' ROOT_DASH = 'openstack-dashboard'
#name used for python install trace
HORIZON_NAME = ROOT_HORIZON
DASH_NAME = 'dashboard' DASH_NAME = 'dashboard'
#config files messed with #config files messed with
HORIZON_PY_CONF = "horizon_settings.py" HORIZON_PY_CONF = "horizon_settings.py"
HORIZON_PY_CONF_TGT = ['local', 'local_settings.py'] HORIZON_PY_CONF_TGT = ['local', 'local_settings.py']
HORIZON_APACHE_CONF = '000-default' HORIZON_APACHE_CONF = '000-default'
CONFIGS = [HORIZON_PY_CONF, HORIZON_APACHE_CONF]
#http://wiki.apache.org/httpd/DistrosDefaultLayout #http://wiki.apache.org/httpd/DistrosDefaultLayout
#TODO: maybe this should be a subclass that handles these differences #TODO: maybe this should be a subclass that handles these differences
APACHE_CONF_TARGETS = { APACHE_CONF_TARGETS = {
settings.UBUNTU11: '/etc/apache2/sites-enabled/000-default', 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.RHEL6: '/etc/httpd/conf.d/wsgi-horizon-000-default.conf',
settings.FEDORA16: '/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 that needs to happen for horizon
DB_SYNC_CMD = ['python', 'manage.py', 'syncdb'] DB_SYNC_CMD = ['python', 'manage.py', 'syncdb']

View File

@ -121,13 +121,16 @@ class KeystoneInstaller(comp.PythonInstallComponent):
def _setup_data(self): def _setup_data(self):
LOG.info("Configuring data setup template %s.", MANAGE_DATA_CONF) LOG.info("Configuring data setup template %s.", MANAGE_DATA_CONF)
#first write it
(_, contents) = utils.load_template(self.component_name, MANAGE_DATA_CONF) (_, contents) = utils.load_template(self.component_name, MANAGE_DATA_CONF)
params = self._get_param_map(MANAGE_DATA_CONF) params = self._get_param_map(MANAGE_DATA_CONF)
contents = utils.param_replace(contents, params, True) contents = utils.param_replace(contents, params, True)
tgt_fn = sh.joinpths(self.bindir, MANAGE_DATA_CONF) tgt_fn = sh.joinpths(self.bindir, MANAGE_DATA_CONF)
sh.write_file(tgt_fn, contents) sh.write_file(tgt_fn, contents)
# This environment additions are important sh.chmod(tgt_fn, 755)
# in that they eventually affect how this script runs #now run it
#these environment additions are important
#in that they eventually affect how this script runs
env = dict() env = dict()
env['ENABLED_SERVICES'] = ",".join(self.instances.keys()) env['ENABLED_SERVICES'] = ",".join(self.instances.keys())
env['BIN_DIR'] = self.bindir env['BIN_DIR'] = self.bindir

View File

@ -298,6 +298,7 @@ class NovaInstaller(comp.PythonInstallComponent):
(_, contents) = utils.load_template(self.component_name, CLEANER_DATA_CONF) (_, contents) = utils.load_template(self.component_name, CLEANER_DATA_CONF)
tgt_fn = sh.joinpths(self.bindir, CLEANER_DATA_CONF) tgt_fn = sh.joinpths(self.bindir, CLEANER_DATA_CONF)
sh.write_file(tgt_fn, contents) sh.write_file(tgt_fn, contents)
sh.chmod(tgt_fn, 755)
self.tracewriter.file_touched(tgt_fn) self.tracewriter.file_touched(tgt_fn)
def _setup_db(self): def _setup_db(self):

View File

@ -44,10 +44,6 @@ CONFIGS = [SWIFT_CONF, PROXY_SERVER_CONF, ACCOUNT_SERVER_CONF,
BIN_DIR = 'bin' BIN_DIR = 'bin'
CONFIG_DIR = 'etc' CONFIG_DIR = 'etc'
# what to start
APP_OPTIONS = {
}
#the pkg json files swift requires for installation #the pkg json files swift requires for installation
REQ_PKGS = ['general.json', 'swift.json'] REQ_PKGS = ['general.json', 'swift.json']

View File

@ -22,6 +22,9 @@ import sys
#but the colors make it worth it :-) #but the colors make it worth it :-)
from termcolor import colored from termcolor import colored
# methods
getLogger = logging.getLogger
class TermFormatter(logging.Formatter): class TermFormatter(logging.Formatter):
def __init__(self, reg_fmt, date_format): def __init__(self, reg_fmt, date_format):
@ -59,7 +62,3 @@ class TermHandler(logging.Handler):
TermHandler.STREAM.write(msg + TermHandler.NL) TermHandler.STREAM.write(msg + TermHandler.NL)
if TermHandler.DO_FLUSH: if TermHandler.DO_FLUSH:
TermHandler.STREAM.flush() TermHandler.STREAM.flush()
def getLogger(name):
return logging.getLogger(name)

View File

@ -10,7 +10,7 @@ import json
import logging import logging
import optparse import optparse
import os import os
import re import re
# Configure logging # Configure logging