Simplify database_connection_url

* does not expects dynamic scoping.
* does not uses eval.

Change-Id: I5ba4e5b7ffaabbb3c2bddadf9e53a2875de8b7c0
This commit is contained in:
Attila Fazekas 2013-03-03 12:23:04 +01:00
parent 48053c791d
commit 7e79d9139f
9 changed files with 12 additions and 26 deletions

View File

@ -68,7 +68,7 @@ function configure_ceilometer() {
iniset $CEILOMETER_CONF DEFAULT notification_topics 'notifications,glance_notifications'
iniset $CEILOMETER_CONF DEFAULT verbose True
iniset $CEILOMETER_CONF DEFAULT sql_connection $BASE_SQL_CONN/nova?charset=utf8
iniset $CEILOMETER_CONF DEFAULT `database_connection_url nova`
# Install the policy file for the API server
cp $CEILOMETER_DIR/etc/ceilometer/policy.json $CEILOMETER_CONF_DIR

View File

@ -185,9 +185,7 @@ function configure_cinder() {
iniset $CINDER_CONF DEFAULT volume_name_template ${VOLUME_NAME_PREFIX}%s
fi
iniset $CINDER_CONF DEFAULT iscsi_helper tgtadm
local dburl
database_connection_url dburl cinder
iniset $CINDER_CONF DEFAULT sql_connection $dburl
iniset $CINDER_CONF DEFAULT sql_connection `database_connection_url cinder`
iniset $CINDER_CONF DEFAULT api_paste_config $CINDER_API_PASTE_INI
iniset $CINDER_CONF DEFAULT rootwrap_config "$CINDER_CONF_DIR/rootwrap.conf"
iniset $CINDER_CONF DEFAULT osapi_volume_extension cinder.api.contrib.standard_extensions

View File

@ -115,9 +115,8 @@ EOF
}
function database_connection_url_mysql {
local output=$1
local db=$2
eval "$output=$BASE_SQL_CONN/$db?charset=utf8"
local db=$1
echo "$BASE_SQL_CONN/$db?charset=utf8"
}
# Restore xtrace

View File

@ -70,9 +70,8 @@ EOF
}
function database_connection_url_postgresql {
local output=$1
local db=$2
eval "$output=$BASE_SQL_CONN/$db?client_encoding=utf8"
local db=$1
echo "$BASE_SQL_CONN/$db?client_encoding=utf8"
}
# Restore xtrace

View File

@ -81,8 +81,7 @@ function configure_glance() {
cp $GLANCE_DIR/etc/glance-registry.conf $GLANCE_REGISTRY_CONF
iniset $GLANCE_REGISTRY_CONF DEFAULT debug True
inicomment $GLANCE_REGISTRY_CONF DEFAULT log_file
local dburl
database_connection_url dburl glance
local dburl=`database_connection_url glance`
iniset $GLANCE_REGISTRY_CONF DEFAULT sql_connection $dburl
iniset $GLANCE_REGISTRY_CONF DEFAULT use_syslog $SYSLOG
iniset $GLANCE_REGISTRY_CONF paste_deploy flavor keystone

View File

@ -117,9 +117,7 @@ function configure_heat() {
iniset $HEAT_ENGINE_CONF DEFAULT heat_metadata_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT
iniset $HEAT_ENGINE_CONF DEFAULT heat_waitcondition_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1/waitcondition
iniset $HEAT_ENGINE_CONF DEFAULT heat_watch_server_url http://$HEAT_API_CW_HOST:$HEAT_API_CW_PORT
local dburl
database_connection_url dburl heat
iniset $HEAT_ENGINE_CONF DEFAULT sql_connection $dburl
iniset $HEAT_ENGINE_CONF DEFAULT sql_connection `database_connection_url heat`
iniset $HEAT_ENGINE_CONF DEFAULT auth_encryption_key `hexdump -n 16 -v -e '/1 "%02x"' /dev/random`
iniset_rpc_backend heat $HEAT_ENGINE_CONF DEFAULT

View File

@ -91,8 +91,6 @@ function configure_keystone() {
fi
# Rewrite stock ``keystone.conf``
local dburl
database_connection_url dburl keystone
if is_service_enabled ldap; then
#Set all needed ldap values
@ -123,7 +121,7 @@ function configure_keystone() {
iniset $KEYSTONE_CONF DEFAULT admin_token "$SERVICE_TOKEN"
iniset $KEYSTONE_CONF signing token_format "$KEYSTONE_TOKEN_FORMAT"
iniset $KEYSTONE_CONF sql connection $dburl
iniset $KEYSTONE_CONF sql connection `database_connection_url keystone`
iniset $KEYSTONE_CONF ec2 driver "keystone.contrib.ec2.backends.sql.Ec2"
sed -e "
/^pipeline.*ec2_extension crud_/s|ec2_extension crud_extension|ec2_extension s3_extension crud_extension|;

View File

@ -377,12 +377,9 @@ function create_nova_conf() {
iniset $NOVA_CONF DEFAULT s3_port "$S3_SERVICE_PORT"
iniset $NOVA_CONF DEFAULT osapi_compute_extension "nova.api.openstack.compute.contrib.standard_extensions"
iniset $NOVA_CONF DEFAULT my_ip "$HOST_IP"
local dburl
database_connection_url dburl nova
iniset $NOVA_CONF DEFAULT sql_connection "$dburl"
iniset $NOVA_CONF DEFAULT sql_connection `database_connection_url nova`
if is_baremetal; then
database_connection_url dburl nova_bm
iniset $NOVA_CONF baremetal sql_connection $dburl
iniset $NOVA_CONF baremetal sql_connection `database_connection_url nova_bm`
fi
iniset $NOVA_CONF DEFAULT libvirt_type "$LIBVIRT_TYPE"
iniset $NOVA_CONF DEFAULT libvirt_cpu_mode "none"

View File

@ -405,9 +405,7 @@ function _configure_quantum_common() {
Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
cp $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE
database_connection_url dburl $Q_DB_NAME
iniset /$Q_PLUGIN_CONF_FILE DATABASE sql_connection $dburl
unset dburl
iniset /$Q_PLUGIN_CONF_FILE DATABASE sql_connection `database_connection_url $Q_DB_NAME`
_quantum_setup_rootwrap
}