Don't hardcode environment.d

Don't assume environment.d is always under /tmp/in_target.d. This makes
dib-run-parts more flexible, and less specific to diskimage-builder. For
instance, dib-run-parts is already used by os-refresh-config, but
/tmp/in_target.d/environment.d is never going to exist when it's called
by os-refresh-config.

This is useful b/c elements can now install os-refresh-config scripts
under /opt/stack/os-config-refresh/environment.d to influence how
further scripts are run. Specifically, the OpenSuse packages prepend the
OpenStack user accounts with "openstack-". Instead of checking for which
users exists with an if/else in all the os-refresh-config scripts that
need to do user related things, we can just update the scripts to use
$NOVA_USER, etc. The OpenSuse element can then install a file under
/opt/stack/os-config-refresh/environment.d to set NOVA_USER to
openstack-nova. We could have files that declare defaults as well within
each specific element, or just set a default variable at the top of each
os-refresh-config script.

Change-Id: Iadbfad995da657e2965fd55fc4ba3a88138b4cfc
This commit is contained in:
James Slagle 2014-02-11 08:33:45 -05:00
parent e06cb80cb6
commit 97b8ffcc46
1 changed files with 4 additions and 2 deletions

View File

@ -70,8 +70,10 @@ fi
PROFILE_DIR=$(mktemp -d /tmp/profiledir.XXXXXX)
if [ -d /tmp/in_target.d/environment.d ] ; then
for env_file in /tmp/in_target.d/environment.d/* ; do
ENVIRONMENT_D_DIR=$target_dir/../environment.d
if [ -d $ENVIRONMENT_D_DIR ] ; then
for env_file in $ENVIRONMENT_D_DIR/* ; do
source $env_file
done
fi