lib/horizon: no need to specify keystone v3 to API version

keystone v3 is the default API version in horizon now,
so there is no need to specify it in local_settings.py explicitly.

This commit also makes minor changes in lib/horizon
_horizon_config_set().

* Do not insert a blank line after each setting.
* Use the local variable $file to specify the target file
  consistently.

Change-Id: I5faea3e1f357726a256d2b48fc1afeabfead4998
This commit is contained in:
Akihiro Motoki 2019-07-24 17:08:44 +09:00
parent 729f8b8ca6
commit deb3ff50f1

View File

@ -43,8 +43,8 @@ function _horizon_config_set {
local value=$4 local value=$4
if [ -z "$section" ]; then if [ -z "$section" ]; then
sed -e "/^$option/d" -i $local_settings sed -e "/^$option/d" -i $file
echo -e "\n$option=$value" >> $file echo "$option = $value" >> $file
elif grep -q "^$section" $file; then elif grep -q "^$section" $file; then
local line local line
line=$(sed -ne "/^$section/,/^}/ { /^ *'$option':/ p; }" $file) line=$(sed -ne "/^$section/,/^}/ { /^ *'$option':/ p; }" $file)
@ -84,6 +84,9 @@ function configure_horizon {
local local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py local local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py
cp $HORIZON_SETTINGS $local_settings cp $HORIZON_SETTINGS $local_settings
# Ensure local_setting.py file ends with EOL (newline)
echo >> $local_settings
_horizon_config_set $local_settings "" WEBROOT \"$HORIZON_APACHE_ROOT/\" _horizon_config_set $local_settings "" WEBROOT \"$HORIZON_APACHE_ROOT/\"
_horizon_config_set $local_settings "" COMPRESS_OFFLINE True _horizon_config_set $local_settings "" COMPRESS_OFFLINE True
@ -91,7 +94,6 @@ function configure_horizon {
_horizon_config_set $local_settings "" OPENSTACK_HOST \"${KEYSTONE_SERVICE_HOST}\" _horizon_config_set $local_settings "" OPENSTACK_HOST \"${KEYSTONE_SERVICE_HOST}\"
_horizon_config_set $local_settings "" OPENSTACK_API_VERSIONS {\"identity\":3}
_horizon_config_set $local_settings "" OPENSTACK_KEYSTONE_URL "\"${KEYSTONE_SERVICE_URI}/v3\"" _horizon_config_set $local_settings "" OPENSTACK_KEYSTONE_URL "\"${KEYSTONE_SERVICE_URI}/v3\""
# note(trebskit): if HOST_IP points at non-localhost ip address, horizon cannot be accessed # note(trebskit): if HOST_IP points at non-localhost ip address, horizon cannot be accessed