cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [2/4] git commit: updated refs/heads/master to fa56b3f
Date Tue, 11 Aug 2015 15:29:24 GMT
make sane defaults for MySQL settings

In dev environments, there is no /etc/cloudstack/management/db.properties file
That forces you to specify all parameters on the command line. This commit
sets some defaults, like port 3306, user root and localhost.

When available, it will still get settings from the config file and it will
also allow you to override it on the command line. So it is fully backwards
compatible.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8a1e79f5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8a1e79f5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8a1e79f5

Branch: refs/heads/master
Commit: 8a1e79f518eadd772913d01c66a98414867fc8a6
Parents: e8ade2d
Author: Remi Bergsma <github@remi.nl>
Authored: Tue Aug 11 13:37:24 2015 +0200
Committer: Remi Bergsma <github@remi.nl>
Committed: Tue Aug 11 14:51:11 2015 +0200

----------------------------------------------------------------------
 .../storage/secondary/cloud-install-sys-tmplt   | 60 ++++++++++----------
 1 file changed, 31 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8a1e79f5/scripts/storage/secondary/cloud-install-sys-tmplt
----------------------------------------------------------------------
diff --git a/scripts/storage/secondary/cloud-install-sys-tmplt b/scripts/storage/secondary/cloud-install-sys-tmplt
index 68409dd..2c4ea36 100755
--- a/scripts/storage/secondary/cloud-install-sys-tmplt
+++ b/scripts/storage/secondary/cloud-install-sys-tmplt
@@ -37,10 +37,10 @@ templateId=
 hyper=
 msKey=password
 DISKSPACE=2120000  #free disk space required in kilobytes
-dbHost=
-dbUser=
+dbHost="localhost"
+dbUser="root"
 dbPassword=
-dbPort=
+dbPort=3306
 jasypt='/usr/share/cloudstack-common/lib/jasypt-1.9.2.jar'
 while getopts 'm:h:f:u:Ft:e:s:o:r:d:p:'# OPTION
 do
@@ -106,18 +106,19 @@ then
   failed 3
 fi
 
-if [ "$pflag" != 1 ]; then
-    dbPort=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.port'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
-fi
+if [ -f /etc/cloudstack/management/db.properties ]; then
+    if [ "$pflag" != 1 ]; then
+        dbPort=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.port'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
+    fi
 
-if [ "$oflag" != 1 ]; then
-    dbHost=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.host'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
-fi
-if [ "$rflag" != 1 ]; then
-    dbUser=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.username'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
-fi
+    if [ "$oflag" != 1 ]; then
+        dbHost=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.host'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
+    fi
+
+    if [ "$rflag" != 1 ]; then
+        dbUser=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.username'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
+    fi
 
-if [ -f /etc/cloudstack/management/db.properties ]; then
     encType=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.encryption.type'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
     if [ "$encType" == "file" ]
     then
@@ -130,23 +131,24 @@ if [ -f /etc/cloudstack/management/db.properties ]; then
             failed 9
         fi
     fi
-fi
 
-if [[ "$encType" == "file" || "$encType" == "web" ]]
-then
-	encPassword=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.password'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i | sed 's/^ENC(\(.*\))/\1/')
-	if [ ! $encPassword == "" ]
-	then
-		dbPassword=(`java -classpath $jasypt org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI decrypt.sh
input=$encPassword password=$msKey verbose=false`)
-		if [ ! $dbPassword ]
-		then
-			echo "Failed to decrypt DB password from db.properties"
-			failed 9
-		fi
-	fi
-else
-    if [ "$dflag" != 1 ]; then
-        dbPassword=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.password'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i )
+    if [[ "$encType" == "file" || "$encType" == "web" ]]
+    then
+        encPassword=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.password'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i | sed 's/^ENC(\(.*\))/\1/')
+        if [ ! $encPassword == "" ]
+        then
+            dbPassword=(`java -classpath $jasypt org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI
decrypt.sh input=$encPassword password=$msKey verbose=false`)
+            if [ ! $dbPassword ]
+            then
+                echo "Failed to decrypt DB password from db.properties"
+                failed 9
+            fi
+        fi
+    else
+        if [ "$dflag" != 1 ]
+        then
+            dbPassword=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.password'
 | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i )
+        fi
     fi
 fi
 


Mime
View raw message