incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: From: jason.bausewein@tier3.com Updated script to create cloud_usage database similar to deploy-db-dev.sh.
Date Tue, 03 Jul 2012 22:17:59 GMT
Updated Branches:
  refs/heads/master 217fdd249 -> 57927c9f2


From: jason.bausewein@tier3.com
Updated script to create cloud_usage database similar to deploy-db-dev.sh.


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

Branch: refs/heads/master
Commit: 57927c9f2365d2696e5b7e312bbe5e35204cbcb9
Parents: 217fdd2
Author: Edison Su <sudison@gmail.com>
Authored: Tue Jul 3 15:16:51 2012 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Tue Jul 3 15:16:51 2012 -0700

----------------------------------------------------------------------
 setup/db/deploy-db-simulator.sh |   46 ++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/57927c9f/setup/db/deploy-db-simulator.sh
----------------------------------------------------------------------
diff --git a/setup/db/deploy-db-simulator.sh b/setup/db/deploy-db-simulator.sh
index 9fe3383..fe21c81 100644
--- a/setup/db/deploy-db-simulator.sh
+++ b/setup/db/deploy-db-simulator.sh
@@ -61,23 +61,31 @@ if [[ $OSTYPE == "cygwin" ]] ; then
   PATHSEP=';'
 fi
 
-echo "Recreating Database."
+handle_error() {
+    mysqlout=$?
+    if [ $mysqlout -eq 1 ]; then
+        printf "Please enter root password for MySQL.\n" 
+        mysql --user=root --password < $1
+        if [ $? -ne 0 ]; then
+            printf "Error: Cannot execute $1\n"
+            exit 10
+        fi
+    elif [ $mysqlout -eq 127 ]; then
+        printf "Error: Cannot execute $1 - mysql command not found.\n"
+        exit 11
+    elif [ $mysqlout -ne 0 ]; then
+        printf "Error: Cannot execute $1\n"
+        exit 11
+    fi
+}
+
+echo "Recreating Database cloud."
 mysql --user=root --password=$3 < create-database.sql > /dev/null 2>/dev/null
-mysqlout=$?
-if [ $mysqlout -eq 1 ]; then
-  printf "Please enter root password for MySQL.\n" 
-  mysql --user=root --password < create-database.sql
-  if [ $? -ne 0 ]; then
-    printf "Error: Cannot execute create-database.sql\n"
-    exit 10
-  fi
-elif [ $mysqlout -eq 127 ]; then
-  printf "Error: Cannot execute create-database.sql - mysql command not found.\n"
-  exit 11
-elif [ $mysqlout -ne 0 ]; then
-  printf "Error: Cannot execute create-database.sql\n"
-  exit 11
-fi
+handle_error create-database.sql
+
+echo "Recreating Database cloud_usage."
+mysql --user=root --password=$3 < create-database-premium.sql > /dev/null 2>/dev/null
+handle_error create-database-premium.sql
 
 mysql --user=cloud --password=cloud cloud < create-schema.sql
 if [ $? -ne 0 ]; then
@@ -85,6 +93,12 @@ if [ $? -ne 0 ]; then
   exit 11
 fi
 
+mysql --user=cloud --password=cloud < create-schema-premium.sql
+if [ $? -ne 0 ]; then
+  printf "Error: Cannot execute create-schema-premium.sql\n"
+  exit 11
+fi
+
 mysql --user=cloud --password=cloud cloud < create-schema-simulator.sql
 if [ $? -ne 0 ]; then
   printf "Error: Cannot execute create-schema-simulator.sql\n"


Mime
View raw message