]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Remove references to the multiple config files
authorAngus Salkeld <asalkeld@redhat.com>
Thu, 29 Aug 2013 02:05:37 +0000 (12:05 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Mon, 2 Sep 2013 00:43:21 +0000 (10:43 +1000)
Only refer to heat.conf in the docs and scripts.
For install.sh copy the iniset() function from devstack
to assist in setting some semi-sane defaults.

Change-Id: I933891e35103c003f1272bc89c7b42d2ad76697b

bin/heat-db-setup
doc/source/getting_started/on_fedora.rst
doc/source/getting_started/on_ubuntu.rst
doc/source/man/heat-api-cfn.rst
doc/source/man/heat-api-cloudwatch.rst
doc/source/man/heat-api.rst
doc/source/man/heat-engine.rst
etc/heat/api-paste.ini
heat/db/sqlalchemy/manage.py
install.sh

index 89905b013f57de383d3e3b18025901bf88280cfb..d7a5844125c59b06982d79003a0e8a496e462aee 100755 (executable)
@@ -63,7 +63,7 @@ start_mysql_server() {
 
 MYSQL_HEAT_PW_DEFAULT="heat"
 MYSQL_HEAT_PW=${MYSQL_HEAT_PW_DEFAULT}
-HEAT_CONFIG="/etc/heat/heat-engine.conf"
+HEAT_CONFIG="/etc/heat/heat.conf"
 ASSUME_YES=""
 ELEVATE=""
 
index 9bf57c7ae4ace034d7e4db74c22fcafc19ccb9fe..05444c4de4f5822165eadcf035846aaa40f7e167 100644 (file)
@@ -111,9 +111,7 @@ In the heat directory, run the install script::
 
 If running OpenStack grizzly installed via tools/openstack, it is necessary to modify the default service user password::
 
-    sudo sed -i "s/verybadpass/secrete/" /etc/heat/heat-api-cfn.conf
-    sudo sed -i "s/verybadpass/secrete/" /etc/heat/heat-api-cloudwatch.conf
-    sudo sed -i "s/verybadpass/secrete/" /etc/heat/heat-api.conf
+    sudo sed -i "s/verybadpass/secrete/" /etc/heat/heat.conf
 
 Source the keystone credentials created with tools/openstack
 ------------------------------------------------------------
@@ -186,9 +184,10 @@ The heat engine configuration file should be updated with the address of the bri
 
 ::
 
-    sudo sed -i -e "/heat_metadata_server_url/ s/127\.0\.0\.1/${BRIDGE_IP}/" /etc/heat/heat-engine.conf
-    sudo sed -i -e "/heat_waitcondition_server_url/ s/127\.0\.0\.1/${BRIDGE_IP}/" /etc/heat/heat-engine.conf
-    sudo sed -i -e "/heat_watch_server_url/ s/127\.0\.0\.1/${BRIDGE_IP}/" /etc/heat/heat-engine.conf
+    sudo sed -i -e "/^\[DEFAULT\]/ a\\\nheat_metadata_server_url=http://${BRIDGE_IP}:8000/\n" /etc/heat/heat.conf
+    sudo sed -i -e "/^\[DEFAULT\]/ a\\\nheat_waitcondition_server_url=http://${BRIDGE_IP}:8000/v1/waitcondition/" /etc/heat/heat.conf
+    sudo sed -i -e "/^\[DEFAULT\]/ a\\\nheat_watch_server_url=http://${BRIDGE_IP}:8003/" /etc/heat/heat.conf
+
 
 Launch the Heat services
 ------------------------
index 7ddb3763fd0ebaf537038c9e78776fb162c47c2c..a1a805ff4c5691db2b5797f6f9f48027f57269da 100644 (file)
@@ -101,9 +101,7 @@ Modify configuration for admin password
 Later a keystone user called '''heat''' will be created. At this point a password for that user needs to be chosen.
 The following files will need editing:
 
-- /etc/heat/heat-api-cfn.conf
-- /etc/heat/heat-api-cloudwatch.conf
-- /etc/heat/heat-api.conf
+- /etc/heat/heat.conf
 
 ::
 
index 9fb7220e74f08af6c91eaa39502feff58dec8e79..257789760605a2c2b424713c05034664edfdf1ab 100644 (file)
@@ -36,4 +36,4 @@ OPTIONS
 FILES
 ========
 
-* /etc/heat/heat-api-cfn.conf
+* /etc/heat/heat.conf
index 192ff251786386400365433fec8cd5f14fb374d8..85aad6bb0a84fb6a4d7b25307c62bf0a5543b260 100644 (file)
@@ -30,4 +30,4 @@ OPTIONS
 FILES
 ========
 
-* /etc/heat/heat-api-cloudwatch.conf
+* /etc/heat/heat.conf
index 3b3823992a653623a15aa287ac96b093a4ede9a2..708e94955ebbb4c3b40ea69ea760a0d585573e24 100644 (file)
@@ -36,4 +36,4 @@ OPTIONS
 FILES
 ========
 
-* /etc/heat/heat-api.conf
+* /etc/heat/heat.conf
index 3071acd19d7d137367d7e38bbacbccf94c279d60..1d9420ba7497651e2cba9d9ee27a7b7b8e9ef328 100644 (file)
@@ -35,4 +35,4 @@ OPTIONS
 FILES
 ========
 
-* /etc/heat/heat-engine.conf
+* /etc/heat/heat.conf
index 273e94c14fb02ad615ae5b148b3615e9f987f09e..3e1094dc6693e08a74a4fbdfb6d3e867b0b5b060 100644 (file)
@@ -7,7 +7,7 @@ pipeline = faultwrap versionnegotiation authtoken context apiv1app
 # ie. uses alternative auth backend that authenticates users against keystone
 # using username and password instead of validating token (which requires
 # an admin/service token).
-# To enable, in heat-api.conf:
+# To enable, in heat.conf:
 #   [paste_deploy]
 #   flavor = standalone
 #
@@ -15,7 +15,7 @@ pipeline = faultwrap versionnegotiation authtoken context apiv1app
 pipeline = faultwrap versionnegotiation authpassword context apiv1app
 
 # heat-api pipeline for custom cloud backends
-# i.e. in heat-api.conf:
+# i.e. in heat.conf:
 #   [paste_deploy]
 #   flavor = custombackend
 #
index 8a7ff1682151cb1a28e5037faef0ff8c8e8f4609..dc7b90746ef79d1ee8468195ae6a6225ec430707 100755 (executable)
@@ -27,7 +27,7 @@ if __name__ == '__main__':
     config = ConfigParser.SafeConfigParser()
     try:
         config = ConfigParser.SafeConfigParser()
-        config.readfp(open('/etc/heat/heat-engine.conf'))
+        config.readfp(open('/etc/heat/heat.conf'))
         sql_connection = config.get('DEFAULT', 'sql_connection')
     except Exception:
         sql_connection = 'mysql://heat:heat@localhost/heat'
index efe1fac5b86794361023e8d99bf099d7ad784d44..40dfefae4cd0d213cac7f1d74206fd2e249f23bb 100755 (executable)
@@ -35,16 +35,60 @@ detect_rabbit() {
     return 1
 }
 
-sed_if_rabbit() {
-    DEFAULT_RABBIT_PASSWORD="guest"
+# Determinate is the given option present in the INI file
+# ini_has_option config-file section option
+function ini_has_option() {
+    local file=$1
+    local section=$2
+    local option=$3
+    local line
+    line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
+    [ -n "$line" ]
+}
+
+# Set an option in an INI file
+# iniset config-file section option value
+function iniset() {
+    local file=$1
+    local section=$2
+    local option=$3
+    local value=$4
+    if ! grep -q "^\[$section\]" "$file"; then
+        # Add section at the end
+        echo -e "\n[$section]" >>"$file"
+    fi
+    if ! ini_has_option "$file" "$section" "$option"; then
+        # Add it
+        sed -i -e "/^\[$section\]/ a\\
+$option = $value
+" "$file"
+    else
+        # Replace it
+        sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" "$file"
+    fi
+}
+
+basic_configuration() {
     conf_path=$1
     if echo $conf_path | grep ".conf$" >/dev/null 2>&1
     then
-    if detect_rabbit
+        iniset $target DEFAULT auth_encryption_key `hexdump -n 16 -v -e '/1 "%02x"' /dev/random`
+        iniset $target DEFAULT db_backend heat.db.sqlalchemy.api
+        iniset $target DEFAULT sql_connection "mysql://heat:heat@localhost/heat"
+
+        BRIDGE_IP=127.0.0.1
+        iniset $target DEFAULT heat_metadata_server_url "http://${BRIDGE_IP}:8000/"
+        iniset $target DEFAULT heat_waitcondition_server_url "http://${BRIDGE_IP}:8000/v1/waitcondition/"
+        iniset $target DEFAULT heat_watch_server_url "http://${BRIDGE_IP}:8003/"
+
+        if detect_rabbit
         then
             echo "rabbitmq detected, configuring $conf_path for rabbit" >&2
-            sed -i "/^rpc_backend\b/ s/impl_qpid/impl_kombu/" $conf_path
-            sed -i "/^rpc_backend/a rabbit_password=$DEFAULT_RABBIT_PASSWORD" $conf_path
+            iniset $conf_path DEFAULT rpc_backend heat.openstack.common.rpc.impl_kombu
+            iniset $conf_path DEFAULT rabbit_password guest
+        else
+            echo "qpid detected, configuring $conf_path for qpid" >&2
+            iniset $conf_path DEFAULT rpc_backend heat.openstack.common.rpc.impl_qpid
         fi
     fi
 }
@@ -55,19 +99,22 @@ install_dir() {
 
     for fn in $(ls $dir); do
         f=$dir/$fn
+        target=$prefix/$f
+        if [ $fn = 'heat.conf.sample' ]; then
+            target=$prefix/$dir/heat.conf
+        fi
         if [ -d $f ]; then
-            [ -d $prefix/$f ] || install -d $prefix/$f
+            [ -d $target ] || install -d $target
             install_dir $f $prefix
-        elif [ -f $prefix/$f ]; then
-            echo "NOT replacing existing config file $prefix/$f" >&2
-            diff -u $prefix/$f $f
+        elif [ -f $target ]; then
+            echo "NOT replacing existing config file $target" >&2
+            diff -u $target $f
         else
             echo "Installing $fn in $prefix/$dir" >&2
-            install -m 664 $f $prefix/$dir
-            if [ $fn = 'heat-engine.conf' ]; then
-                sed -i "s/%ENCRYPTION_KEY%/`hexdump -n 16 -v -e '/1 "%02x"' /dev/random`/" $prefix/$f
+            install -m 664 $f $target
+            if [ $fn = 'heat.conf.sample' ]; then
+                basic_configuration $target
             fi
-            sed_if_rabbit $prefix/$f
         fi
     done
 }