incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [3/5] git commit: CloudStack CLOUDSTACK-257 AWS Api is not correctly deployed
Date Mon, 08 Oct 2012 07:07:37 GMT
CloudStack CLOUDSTACK-257
AWS Api is not correctly deployed

fix cloud-setup-databases for awsapi


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

Branch: refs/heads/master
Commit: a6dcd7af4962a584f46d9b7271e2c225618624ed
Parents: ab26fe7
Author: frank <frank.zhang@citrix.com>
Authored: Sun Oct 7 23:13:37 2012 -0700
Committer: Alex Huang <alex.huang@citrix.com>
Committed: Mon Oct 8 00:06:04 2012 -0700

----------------------------------------------------------------------
 setup/bindir/cloud-setup-databases.in |   52 +++++++++++++---------------
 1 files changed, 24 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6dcd7af/setup/bindir/cloud-setup-databases.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-setup-databases.in b/setup/bindir/cloud-setup-databases.in
index a17b131..e488611 100755
--- a/setup/bindir/cloud-setup-databases.in
+++ b/setup/bindir/cloud-setup-databases.in
@@ -1,24 +1,6 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
 import os
 import sys
 import subprocess
@@ -69,7 +51,7 @@ class DBDeployer(object):
     dbDotProperties = {}
     dbDotPropertiesIndex = 0
     encryptionKeyFile = '@MSCONF@/key'
-    encryptionJarPath = '@JAVADIR@/jasypt-1.9.0.jar'
+    encryptionJarPath = '@JAVADIR@/cloud-jasypt-1.8.jar'
     success = False
     magicString = 'This_is_a_magic_string_i_think_no_one_will_duplicate'
     tmpMysqlFile = os.path.join(os.path.expanduser('~/'), 'cloudstackmysql.tmp.sql')
@@ -149,6 +131,7 @@ class DBDeployer(object):
             mysqlCmds.append('<')
             mysqlCmds.append(self.tmpMysqlFile)
             runCmd(mysqlCmds)
+            
         except Exception, e:
             err = '''Encountering an error when executing mysql script
 ----------------------------------------------------------------------
@@ -257,6 +240,26 @@ for full help
             self.info("Applying %s"%p)
             self.runMysql(text, p, True)
             self.info(None, True)
+            
+        awsApiDbDir = '/usr/share/cloud/setup/bridge/db'
+        for f in ["cloudbridge_db.sql"]:
+            p = os.path.join(awsApiDbDir,f)
+            if not os.path.exists(p): continue
+            text = file(p).read()
+            for t, r in replacements: text = text.replace(t,r)
+            self.info("Applying %s"%p)
+            self.runMysql(text, p, True)
+            self.info(None, True)
+
+        for f in ["cloudbridge_schema", "cloudbridge_multipart", "cloudbridge_index", "cloudbridge_multipart_alter",
"cloudbridge_bucketpolicy", "cloudbridge_policy_alter",
+            "cloudbridge_offering", "cloudbridge_offering_alter"]:
+            if os.path.isfile(p):
+                p = os.path.join(awsApiDbDir,"%s.sql"%f)
+                if not os.path.exists(p): continue
+                text = file(p).read()
+                self.info("Applying %s"%p)
+                self.runMysql(text, p, True)
+                self.info(None, True)
                
     def prepareDBFiles(self):
         def prepareDBDotProperties():
@@ -475,15 +478,8 @@ for example:
                 self.errorAndExit("There are more than one parameters for user:password@hostname
(%s)"%self.args)
             
             arg = self.args[0]
-            try:
-                splitIndex = arg.rindex('@')
-            except ValueError:
-                # If it failed to find @, use host=localhost
-                splitIndex = len(arg)
-                arg += "@localhost"
-            finally:
-                stuff = [arg[:splitIndex], arg[splitIndex+1:]]
-
+            stuff = arg.split("@", 1)
+            if len(stuff) == 1: stuff.append("localhost")
             self.user,self.password = parseUserAndPassword(stuff[0])
             self.host,self.port = parseHostInfo(stuff[1])
             


Mime
View raw message