Merge branch 'master' of github.com:yahoo/Openstack-Devstack2

This commit is contained in:
Joshua Harlow 2012-01-25 10:28:03 -08:00
commit 1a48517931
24 changed files with 37 additions and 26 deletions

View File

@ -86,13 +86,21 @@ Check out *conf/stack.ini* for various configuration settings applied (branches,
Check out *conf/* for various component specific settings and files.
Note that some of these files are templates (*TODO* rename the files so that people can see this). These files may have strings of the format *%NAME%* where *NAME* will most often be adjusted to a real value by the *stack* script.
Note that some of these files are templates (ones ending with *.tpl*).
These files may have strings of the format *%NAME%* where *NAME* will most often be adjusted to a real value by the *stack* script.
An example where this is useful is say for the following line:
admin_token = %SERVICE_TOKEN%
Since the script will either prompt for this value (or generate it for you) we can not have this statically set in a configuration file.
### conf/pkgs
Check out *conf/pkgs* for package listings and *conf/pips* for python packages for various distributions.
Note that these files are in a modified json format which allows for simple comments (lines starting with #). These comments are useful for explanations of why a version was chosen or the like.
Note that these files are in a modified json format which allows for simple comments (lines starting with #).
These comments are useful for explanations of why a version was chosen or the like.
# Starting
@ -108,6 +116,7 @@ Note that these files are in a modified json format which allows for simple comm
1. Run: *./stack -a install -d $HOME/openstack -c glance*
* *Note:* This will also install glances dependencies (to show dependencies run *./stack -s*)
* If this is undesired try the *--ignore-deps* option
1. When prompted for passwords either press enter (to have it generate one) or enter a password.
1. Wait for it to finish...
* On finish you should see all configurations/passwords/database dsn's that have been fetched (for future reference).
@ -145,6 +154,7 @@ An example of this end state is the following:
1. Run *./stack -a start -d $HOME/openstack -c glance*
* *Note:* This will also start glances dependencies (to show dependencies run *./stack -s*)
* If this is undesired try the *--ignore-deps* option
* *Note:* Currently forking is done instead of running screen (*TODO* get screen working)
1. On finish you should see a list of files which will have information about what is started
* For forking mode this will be a file with information on where the PID is, where the STDERR/STDOUT files are.
@ -162,6 +172,7 @@ An example of one of these files is the following:
1. Run *./stack -a stop -d $HOME/openstack -c glance*
* *Note:* This will also stop glances dependencies (to show dependencies run *./stack -s*)
* If this is undesired try the *--ignore-deps* option
On finish you should see something like the following:
@ -180,7 +191,7 @@ On finish you should see something like the following:
1. Run *./stack -a uninstall -d $HOME/openstack -c glance*
* *Note:* This will also uninstall glances dependencies (to show dependencies run *./stack -s*)
* If this is undesired try the *--ignoredeps* option
* If this is undesired try the *--ignore-deps* option
* *Note:* This may also require *sudo* access to cleanup all the necessary directories that python sets up.
On finish you should see something like the following:

View File

@ -123,17 +123,11 @@ class PkgInstallComponent(ComponentBase):
def _config_adjust(self, contents, config_fn):
return contents
def get_target_config_name(self, config_fn):
if(config_fn not in self._get_config_files()):
return None
else:
return sh.joinpths(self.cfgdir, config_fn)
def _get_target_config_name(self, config_fn):
return sh.joinpths(self.cfgdir, config_fn)
def _get_source_config_name(self, config_fn):
if(config_fn not in self._get_config_files()):
return None
else:
return sh.joinpths(settings.STACK_CONFIG_DIR, self.component_name, config_fn)
def _get_source_config(self, config_fn):
return utils.load_template(self.component_name, config_fn)
def _configure_files(self):
configs = self._get_config_files()
@ -142,13 +136,12 @@ class PkgInstallComponent(ComponentBase):
for fn in configs:
#get the params and where it should come from and where it should go
parameters = self._get_param_map(fn)
sourcefn = self._get_source_config_name(fn)
tgtfn = self.get_target_config_name(fn)
tgtfn = self._get_target_config_name(fn)
#ensure directory is there (if not created previously)
self.tracewriter.make_dir(sh.dirname(tgtfn))
#now configure it
LOG.info("Configuring template file %s" % (sourcefn))
contents = sh.load_file(sourcefn)
LOG.info("Configuring template file %s" % (fn))
(sourcefn, contents) = self._get_source_config(fn)
LOG.info("Replacing parameters in file %s" % (sourcefn))
LOG.debug("Replacements = %s" % (parameters))
contents = utils.param_replace(contents, parameters)

View File

@ -29,7 +29,7 @@ DASH_NAME = 'dashboard'
HORIZON_PY_CONF = "horizon_settings.py"
HORIZON_PY_CONF_TGT = ['local', 'local_settings.py']
HORIZON_APACHE_CONF = '000-default.template'
HORIZON_APACHE_CONF = '000-default'
HORIZON_APACHE_TGT = ['/', 'etc', 'apache2', 'sites-enabled', '000-default']
CONFIGS = [HORIZON_PY_CONF, HORIZON_APACHE_CONF]
@ -63,14 +63,14 @@ class HorizonInstaller(comp.PythonInstallComponent):
})
return places
def get_target_config_name(self, config_name):
def _get_target_config_name(self, config_name):
if(config_name == HORIZON_PY_CONF):
return sh.joinpths(self.dash_dir, *HORIZON_PY_CONF_TGT)
elif(config_name == HORIZON_APACHE_CONF):
#this may require sudo of the whole program to be able to write here.
return sh.joinpths(*HORIZON_APACHE_TGT)
else:
return comp.PythonInstallComponent.get_target_config_name(self, config_name)
return comp.PythonInstallComponent._get_target_config_name(self, config_name)
def _get_python_directories(self):
py_dirs = list()

View File

@ -89,15 +89,14 @@ class KeystoneInstaller(comp.PythonInstallComponent):
db.create_db(self.cfg, DB_NAME)
def _setup_data(self):
# TODO clean this up once it works
src_fn = sh.joinpths(settings.STACK_CONFIG_DIR, TYPE, MANAGE_DATA_CONF)
contents = sh.load_file(src_fn)
LOG.info("Configuring data setup template %s", MANAGE_DATA_CONF)
(src_fn, 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 keystone-manage runs so make sure its set.
# in that they eventually affect how this script runs
env = dict()
env['ENABLED_SERVICES'] = ",".join(self.instances.keys())
env['BIN_DIR'] = self.bindir

View File

@ -145,7 +145,7 @@ class NovaInstaller(comp.PythonInstallComponent):
dirs['bin'] = self.bindir
conf_gen = NovaConfigurator(self.cfg, self.instances)
nova_conf = conf_gen.configure(dirs)
tgtfn = self.get_target_config_name(API_CONF)
tgtfn = self._get_target_config_name(API_CONF)
LOG.info("Writing conf to %s" % (tgtfn))
LOG.info(nova_conf)
sh.write_file(tgtfn, nova_conf)

View File

@ -60,7 +60,7 @@ class ForkRunner(object):
"kill pid %s" % (SLEEP_TIME, pid))
time.sleep(SLEEP_TIME)
except OSError, e:
ec, _ = e
ec = e.errno
if ec == errno.ESRCH:
killed = True
break

View File

@ -33,6 +33,14 @@ from devstack import version
PARAM_SUB_REGEX = re.compile(r"%([\w\d]+?)%")
LOG = logging.getLogger("devstack.util")
TEMPLATE_EXT = ".tpl"
def load_template(component, fn):
actual_fn = fn + TEMPLATE_EXT
full_pth = os.path.join(settings.STACK_CONFIG_DIR, component, actual_fn)
contents = sh.load_file(full_pth)
return (full_pth, contents)
def execute_template(*cmds, **kargs):