diff --git a/.gitignore b/.gitignore index 3a357c3c..59253dd1 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ AUTHORS ChangeLog etc/tuskar/tuskar.conf *.sqlite +tuskar/api/templates/tripleo-heat-templates/ diff --git a/INSTALL.rst b/INSTALL.rst index 39b03ab9..30488e05 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -56,6 +56,17 @@ Note: replace these values with credentials for our undercloud OpenStack. If you're using `Devstack `_, the username and password are printed out when `stack.sh` finishes its job. +You will need a local checkout of the tripleo-heat-templates. A +configuration entry is defined for this purpose: tht_local_dir should point +to your local copy of the tripleo-heat-templates. + + tht_local_dir = "/etc/tuskar/tripleo-heat-templates/" + +At tuskar startup, if the directory specified by tht_local_dir in your +tuskar.conf doesn't exist startup will fail. You can clone the templates: + + (sudo) git clone https://github.com/openstack/tripleo-heat-templates.git /etc/tuskar/tripleo-heat-templates/ + We need to initialise the database schema:: # activate the virtualenv diff --git a/etc/tuskar/tuskar.conf.sample b/etc/tuskar/tuskar.conf.sample index 58756ec8..e60ecc66 100644 --- a/etc/tuskar/tuskar.conf.sample +++ b/etc/tuskar/tuskar.conf.sample @@ -27,6 +27,7 @@ # The port for the Tuskar API server (integer value) #tuskar_api_port=8585 +#tht_local_dir="/etc/tuskar/tripleo-heat-templates/" # # Options defined in tuskar.api.app diff --git a/tuskar/api/__init__.py b/tuskar/api/__init__.py index 04ebab1e..25695031 100644 --- a/tuskar/api/__init__.py +++ b/tuskar/api/__init__.py @@ -31,6 +31,10 @@ API_SERVICE_OPTS = [ default=8585, help='The port for the Tuskar API server', ), + cfg.StrOpt('tht_local_dir', + default='/etc/tuskar/tripleo-heat-templates/', + help='Local path holding tripleo-heat-templates', + ) ] CONF = cfg.CONF diff --git a/tuskar/cmd/api.py b/tuskar/cmd/api.py index 7aab942e..d5e2d195 100644 --- a/tuskar/cmd/api.py +++ b/tuskar/cmd/api.py @@ -21,6 +21,7 @@ """The Tuskar Service API.""" import logging +import os import sys from oslo.config import cfg @@ -48,6 +49,17 @@ def main(): LOG.info("Serving on http://%s:%s" % (host, port)) LOG.info("Configuration:") CONF.log_opt_values(LOG, logging.INFO) + # make sure we have tripleo-heat-templates: + heat_template_path = CONF.tht_local_dir + try: + templates = os.listdir(heat_template_path) + except OSError: + LOG.info("Can't find local tripleo-heat-template files at %s" + % (heat_template_path)) + LOG.info("Cannot proceed - missing tripleo heat templates " + + "See INSTALL documentation for more info") + raise + LOG.info("Using tripleo-heat-templates at %s" % (heat_template_path)) try: wsgi.serve_forever()