Updated with glance and keystone working! Ya! And added a check bash script to check pep8 and pylint. Useful soon.
This commit is contained in:
parent
fbe934bcbc
commit
59a883249e
@ -2,7 +2,7 @@ Devstack v2 is a set of python scripts and utilities to quickly deploy an OpenSt
|
|||||||
|
|
||||||
# Goals
|
# Goals
|
||||||
|
|
||||||
* To quickly build dev OpenStack environments in a clean environment (as well as start, stop, and uninstall those environments)
|
* To quickly build dev OpenStack environments in a clean environment (as well as start, stop, and uninstall those environments) with as little baggage as possible
|
||||||
* To describe working configurations of OpenStack (which code branches work together? what do config files look like for those branches? what packages are needed for installation?)
|
* To describe working configurations of OpenStack (which code branches work together? what do config files look like for those branches? what packages are needed for installation?)
|
||||||
* To make it easier for developers to dive into OpenStack so that they can productively contribute without having to understand every part of the system at once
|
* To make it easier for developers to dive into OpenStack so that they can productively contribute without having to understand every part of the system at once
|
||||||
* To make it easy to prototype cross-project features
|
* To make it easy to prototype cross-project features
|
||||||
@ -38,6 +38,9 @@ This will typically produce:
|
|||||||
|
|
||||||
# Stack prerequisites
|
# Stack prerequisites
|
||||||
|
|
||||||
|
* linux (tested on ubuntu 11 and rhel 6)
|
||||||
|
* python 2.6 or 2.7 (not tested with python 3.0)
|
||||||
|
* git
|
||||||
* easy_install termcolor (used for colored console logging)
|
* easy_install termcolor (used for colored console logging)
|
||||||
* easy_install netifaces (used to determine host ip information)
|
* easy_install netifaces (used to determine host ip information)
|
||||||
|
|
||||||
|
@ -10,13 +10,15 @@
|
|||||||
# Set api host endpoint
|
# Set api host endpoint
|
||||||
host_ip = ${HOST_IP:-}
|
host_ip = ${HOST_IP:-}
|
||||||
|
|
||||||
#Sys log enabled or not
|
# Sys log enabled or not
|
||||||
syslog = 0
|
syslog = 0
|
||||||
|
|
||||||
[db]
|
[db]
|
||||||
|
|
||||||
|
# Where you db is located at and how to access it
|
||||||
sql_host = ${SQL_HOST:-localhost}
|
sql_host = ${SQL_HOST:-localhost}
|
||||||
sql_user = ${SQL_USER:-root}
|
sql_user = ${SQL_USER:-root}
|
||||||
|
port = ${SQL_PORT:-3306}
|
||||||
|
|
||||||
#internal commands are dependent on this...
|
#internal commands are dependent on this...
|
||||||
type = mysql
|
type = mysql
|
||||||
|
@ -182,6 +182,7 @@ class PythonInstallComponent(PkgInstallComponent):
|
|||||||
(sysout, stderr) = execute(*PY_INSTALL, cwd=self.appdir, run_as_root=True)
|
(sysout, stderr) = execute(*PY_INSTALL, cwd=self.appdir, run_as_root=True)
|
||||||
write_file(recordwhere, sysout)
|
write_file(recordwhere, sysout)
|
||||||
|
|
||||||
|
# Overridden
|
||||||
def install(self):
|
def install(self):
|
||||||
self._do_pkg_install()
|
self._do_pkg_install()
|
||||||
self._python_install()
|
self._python_install()
|
||||||
|
@ -33,7 +33,7 @@ class EnvConfigParser(ConfigParser.RawConfigParser):
|
|||||||
ConfigParser.RawConfigParser.__init__(self)
|
ConfigParser.RawConfigParser.__init__(self)
|
||||||
self.pws = dict()
|
self.pws = dict()
|
||||||
self.configs_fetched = dict()
|
self.configs_fetched = dict()
|
||||||
self.dbdsns = dict()
|
self.db_dsns = dict()
|
||||||
|
|
||||||
def _makekey(self, section, option):
|
def _makekey(self, section, option):
|
||||||
return option + "@" + section
|
return option + "@" + section
|
||||||
@ -50,23 +50,42 @@ class EnvConfigParser(ConfigParser.RawConfigParser):
|
|||||||
self.configs_fetched[key] = v
|
self.configs_fetched[key] = v
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return (len(self.pws) +
|
||||||
|
len(self.configs_fetched) +
|
||||||
|
len(self.db_dsns))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
str_repr = ""
|
#this will make the items nice and pretty
|
||||||
|
def item_format(k, v):
|
||||||
|
return "\t%s=%s" % (str(k), str(v))
|
||||||
|
#collect all the lines
|
||||||
|
password_lines = list()
|
||||||
if(len(self.pws)):
|
if(len(self.pws)):
|
||||||
str_repr += "Passwords:" + os.linesep
|
password_lines.append("Passwords:")
|
||||||
for (k,v) in self.pws.items():
|
keys = sorted(self.pws.keys())
|
||||||
str_repr += "\t" + str(k) + " = " + str(v) + os.linesep
|
for key in keys:
|
||||||
|
value = self.pws.get(key)
|
||||||
|
password_lines.append(item_format(key, value))
|
||||||
|
cfg_lines = list()
|
||||||
if(len(self.configs_fetched)):
|
if(len(self.configs_fetched)):
|
||||||
str_repr += "Configs:" + os.linesep
|
cfg_lines.append("Configs:")
|
||||||
for (k,v) in self.configs_fetched.items():
|
keys = sorted(self.configs_fetched.keys())
|
||||||
if(k in self.pws):
|
for key in keys:
|
||||||
|
if(key in self.pws):
|
||||||
continue
|
continue
|
||||||
str_repr += "\t" + str(k) + " = " + str(v) + os.linesep
|
value = self.configs_fetched.get(key)
|
||||||
if(len(self.dbdsns)):
|
cfg_lines.append(item_format(key, value))
|
||||||
str_repr += "Data source names:" + os.linesep
|
dsn_lines = list()
|
||||||
for (k, v) in self.dbdsns.items():
|
if(len(self.db_dsns)):
|
||||||
str_repr += "\t" + str(k) + " = " + str(v) + os.linesep
|
dsn_lines.append("Data source names:")
|
||||||
return str_repr
|
keys = sorted(self.db_dsns.keys())
|
||||||
|
for key in keys:
|
||||||
|
value = self.db_dsns.get(key)
|
||||||
|
dsn_lines.append(item_format(key, value))
|
||||||
|
#make a nice string
|
||||||
|
combined_lines = cfg_lines + password_lines + dsn_lines
|
||||||
|
return os.linesep.join(combined_lines)
|
||||||
|
|
||||||
def _get_special(self, section, option):
|
def _get_special(self, section, option):
|
||||||
key = self._makekey(section, option)
|
key = self._makekey(section, option)
|
||||||
@ -89,14 +108,14 @@ class EnvConfigParser(ConfigParser.RawConfigParser):
|
|||||||
else:
|
else:
|
||||||
return v
|
return v
|
||||||
|
|
||||||
def get_dbdsn(dbname):
|
def get_dbdsn(self, dbname):
|
||||||
user = self.get("db", "sql_user")
|
user = self.get("db", "sql_user")
|
||||||
host = self.get("db", "sql_host")
|
host = self.get("db", "sql_host")
|
||||||
port = self.get("db", "port")
|
port = self.get("db", "port")
|
||||||
pw = self.getpw("passwords", "sql")
|
pw = self.getpw("passwords", "sql")
|
||||||
#check the dsn cache
|
#check the dsn cache
|
||||||
if(dbname in self.dbdsns):
|
if(dbname in self.db_dsns):
|
||||||
return self.dbdsns[dbname]
|
return self.db_dsns[dbname]
|
||||||
#form the dsn (from components we have...)
|
#form the dsn (from components we have...)
|
||||||
#dsn = "<driver>://<username>:<password>@<host>:<port>/<database>"
|
#dsn = "<driver>://<username>:<password>@<host>:<port>/<database>"
|
||||||
if(not host):
|
if(not host):
|
||||||
@ -109,9 +128,9 @@ class EnvConfigParser(ConfigParser.RawConfigParser):
|
|||||||
dsn = driver + "://"
|
dsn = driver + "://"
|
||||||
if(user):
|
if(user):
|
||||||
dsn += user
|
dsn += user
|
||||||
if(password):
|
if(pw):
|
||||||
dsn += ":" + password
|
dsn += ":" + pw
|
||||||
if(user or password):
|
if(user or pw):
|
||||||
dsn += "@"
|
dsn += "@"
|
||||||
dsn += host
|
dsn += host
|
||||||
if(port):
|
if(port):
|
||||||
@ -120,8 +139,9 @@ class EnvConfigParser(ConfigParser.RawConfigParser):
|
|||||||
dsn += "/" + dbname
|
dsn += "/" + dbname
|
||||||
else:
|
else:
|
||||||
dsn += "/"
|
dsn += "/"
|
||||||
|
LOG.debug("For database %s fetched dsn %s" % (dbname, dsn))
|
||||||
#store for later...
|
#store for later...
|
||||||
self.dbdsns[dbname] = dsn
|
self.db_dsns[dbname] = dsn
|
||||||
return dsn
|
return dsn
|
||||||
|
|
||||||
def getpw(self, section, option):
|
def getpw(self, section, option):
|
||||||
|
@ -24,6 +24,7 @@ from Util import (GLANCE,
|
|||||||
get_host_ip, param_replace)
|
get_host_ip, param_replace)
|
||||||
from Shell import (deldir, mkdirslist, unlink,
|
from Shell import (deldir, mkdirslist, unlink,
|
||||||
joinpths, touch_file)
|
joinpths, touch_file)
|
||||||
|
import Db
|
||||||
|
|
||||||
LOG = Logger.getLogger("install.glance")
|
LOG = Logger.getLogger("install.glance")
|
||||||
|
|
||||||
@ -75,6 +76,16 @@ class GlanceInstaller(PythonInstallComponent):
|
|||||||
#these are the config files we will be adjusting
|
#these are the config files we will be adjusting
|
||||||
return list(CONFIGS)
|
return list(CONFIGS)
|
||||||
|
|
||||||
|
def install(self):
|
||||||
|
parent_res = PythonInstallComponent.install(self)
|
||||||
|
#setup the database
|
||||||
|
self._setup_db()
|
||||||
|
return parent_res
|
||||||
|
|
||||||
|
def _setup_db(self):
|
||||||
|
Db.drop_db(self.cfg, DB_NAME)
|
||||||
|
Db.create_db(self.cfg, DB_NAME)
|
||||||
|
|
||||||
def _config_adjust(self, contents, fn):
|
def _config_adjust(self, contents, fn):
|
||||||
lines = contents.splitlines()
|
lines = contents.splitlines()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
@ -58,17 +58,15 @@ class KeystoneInstaller(PythonInstallComponent):
|
|||||||
self.bindir = joinpths(self.appdir, BIN_DIR)
|
self.bindir = joinpths(self.appdir, BIN_DIR)
|
||||||
|
|
||||||
def _get_download_location(self):
|
def _get_download_location(self):
|
||||||
uri = self.gitloc
|
return (self.gitloc, self.brch)
|
||||||
branch = self.brch
|
|
||||||
return (uri, branch)
|
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
PythonInstallComponent.install(self)
|
parent_res = PythonInstallComponent.install(self)
|
||||||
#adjust db
|
#adjust db
|
||||||
self._setup_db()
|
self._setup_db()
|
||||||
#setup any data
|
#setup any data
|
||||||
self._setup_data()
|
self._setup_data()
|
||||||
return self.tracedir
|
return parent_res
|
||||||
|
|
||||||
def _get_config_files(self):
|
def _get_config_files(self):
|
||||||
return list(CONFIGS)
|
return list(CONFIGS)
|
||||||
|
@ -39,8 +39,9 @@ function run_pep8 {
|
|||||||
srcfiles=`find devstack -type f | grep "py\$"`
|
srcfiles=`find devstack -type f | grep "py\$"`
|
||||||
srcfiles+=" stack"
|
srcfiles+=" stack"
|
||||||
pep_ignores="E202"
|
pep_ignores="E202"
|
||||||
|
tee_fn="pep8.log"
|
||||||
pep8_opts="--ignore=$pep_ignores --repeat"
|
pep8_opts="--ignore=$pep_ignores --repeat"
|
||||||
echo "$(${wrapper} pep8 ${pep8_opts} ${srcfiles} 2>&1)"
|
echo "$(${wrapper} pep8 ${pep8_opts} ${srcfiles} 2>&1 | tee $tee_fn)"
|
||||||
if [ "$?" -ne "0" ]; then
|
if [ "$?" -ne "0" ]; then
|
||||||
echo "Sorry, cannot run pep8 ..."
|
echo "Sorry, cannot run pep8 ..."
|
||||||
exit 1
|
exit 1
|
||||||
@ -54,8 +55,9 @@ function run_pylint {
|
|||||||
echo "Running pylint ..."
|
echo "Running pylint ..."
|
||||||
srcfiles=`find devstack -type f | grep "py\$"`
|
srcfiles=`find devstack -type f | grep "py\$"`
|
||||||
srcfiles+=" stack"
|
srcfiles+=" stack"
|
||||||
|
tee_fn="pylint.log"
|
||||||
pylint_opts="--rcfile=$pylintrc_fn"
|
pylint_opts="--rcfile=$pylintrc_fn"
|
||||||
echo "$(${wrapper} pylint ${pylint_opts} ${srcfiles} 2>&1)"
|
echo "$(${wrapper} pylint ${pylint_opts} ${srcfiles} 2>&1 | tee $tee_fn)"
|
||||||
if [ "$?" -ne "0" ]; then
|
if [ "$?" -ne "0" ]; then
|
||||||
echo "Sorry, cannot run pylint ..."
|
echo "Sorry, cannot run pylint ..."
|
||||||
exit 1
|
exit 1
|
||||||
|
6
stack
6
stack
@ -116,8 +116,10 @@ def get_config(action):
|
|||||||
|
|
||||||
|
|
||||||
def print_cfgs(cfg, action):
|
def print_cfgs(cfg, action):
|
||||||
LOG.info("After %s your config is:" % (action))
|
cfg_str = str(cfg).strip()
|
||||||
LOG.info(str(cfg).rstrip())
|
if(len(cfg)):
|
||||||
|
LOG.info("After %s your config is:" % (action))
|
||||||
|
LOG.info(cfg_str)
|
||||||
|
|
||||||
|
|
||||||
def runner(action_name, component_set, distro, root_dir, program_args):
|
def runner(action_name, component_set, distro, root_dir, program_args):
|
||||||
|
Loading…
Reference in New Issue
Block a user