Fixed various mysql set up problems
authorAlberto Di Meglio <alberto.di.meglio@cern.ch>
Fri, 19 Aug 2005 12:46:47 +0000 (12:46 +0000)
committerAlberto Di Meglio <alberto.di.meglio@cern.ch>
Fri, 19 Aug 2005 12:46:47 +0000 (12:46 +0000)
org.glite.deployment.lb/config/scripts/glite-lb-config.py
org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
org.glite.deployment.lb/project/lxscript-rpm.xsl
org.glite.deployment.lb/project/version.properties

index 61f5e5c..681185e 100644 (file)
@@ -6,7 +6,7 @@
 # For license conditions see the license file or http://eu-egee.org/license.html
 #
 ################################################################################
-# glite-lb-config v. 2.0.0
+# glite-lb-config v. 2.0.1
 #
 # Post-installation script for configuring the gLite Logging and Bookkeping Server
 # Robert Harakaly < robert.harakaly@cern.ch >
@@ -46,7 +46,7 @@ class glite_lb:
     def __init__(self):
         self.mysql = MySQL.Mysql()
         self.verbose = 0
-        self.version = "2.0.0"
+        self.version = "2.0.1"
         self.name = "glite-lb"
         self.friendly_name = "gLite Logging and Bookkeeping"
         params['module.version'] = self.version
@@ -249,17 +249,28 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
         os.chmod("%s/hostkey.pem" % lb_cert_path, 0400)
         glib.printOkMessage()
 
-        # Create the MySQL database
-        print "\nCreate/Verify the %s database" % params['lb.database.name']
+        #--------------------------------------------------------
+        # Configure MySQL
+        #--------------------------------------------------------
+
+        # start MySQL
         self.mysql.stop()
         time.sleep(5)
-        self.mysql.start()
+        self.mysql.start()                
+
+        # Set root password
+        mysql_root_password = params['mysql.root.password']
+        if mysql_root_password != "":
+            self.mysql.setpassword(mysql_root_password)
+
+        # Create the MySQL database
+        print "\nCreate/Verify the %s database" % params['lb.database.name']
         
         if not os.path.exists('/tmp/mysql.sock'):
             os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
 
         # Check if database exists
-        if self.mysql.existsDB(params['lb.database.name']) != 0:
+        if self.mysql.existsDB(params['lb.database.name'],mysql_root_password) != 0:
             # Create database
             print ('\n==> Creating MySQL %s database\n' % params['lb.database.name'])
     
@@ -275,7 +286,7 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
     
             file.writelines(text)
             file.close()
-            os.system('/usr/bin/mysql < /tmp/mysql_ct')
+            os.system('/usr/bin/mysql -p%s < /tmp/mysql_ct' % mysql_root_password)
             os.system('/bin/rm /tmp/mysql_ct')
             
             #Starting and stopping the database before the index creation
@@ -335,6 +346,14 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
 # Set all environment variables
 #-------------------------------------------------------------------------------
 
+def loadDefaults(params):
+
+    params['GLITE_LOCATION'] = "/opt/glite"
+    params['GLITE_LOCATION'] = "/opt/glite"
+    params['mysql.root.password'] = ""
+    params['lb.database.name'] = "lbserver20"
+    params['lb.database.username'] = "lbserver"
+
 def set_env():
 
     # gLite
@@ -390,6 +409,7 @@ if __name__ == '__main__':
     
     # Load parameters
     params = {}
+    loadDefaults(params)
     try:
         opts, args = getopt.getopt(sys.argv[1:], '', ['siteconfig='])
         for o, a in opts:
index 0eeb26d..72ada69 100644 (file)
                        parameter. Leave it empty of comment it out to use the same as 'glite.user.name'"
                        value="changeme"/>
                
+           <mysql.root.password
+               description="The mysql root password"
+               value="changeme"/>
+       
                <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
                <!-- Advanced parameters - Change them if you know what you're doing -->
                <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
                        description="Enable check of host certificates"
                        value="true"/>
 
-               <!-- MySQL DB -->
-               <lb.database.name
-                       description="The mySQL database name to create for storing LB data
-                       In this version it must be set to the given value"
-                       value="lbserver20"/>
-
+               <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
+               <!-- System parameters - You should leave these alone -->
+               <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->               
+       
                <lb.index.list
                        description="Definitions of indices on all the currently supported indexed system attributes">
                        
 
                </lb.index.list>
                        
-               <lb.database.username
-                       description="The username to be used to access the local mySQL server
-                       In this version it must be set to the given value"
-                       value="lbserver"/>
-                       
-               <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
-               <!-- System parameters - You should leave these alone -->
-               <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->               
-       
        </parameters>
 
        <!--RGMA service publishing: log server -->
index e20f297..0bf5cc8 100644 (file)
@@ -137,11 +137,13 @@ function install()
                echo Done!
                echo
                echo Before using the gLite LB, please create or update the configuration
-               echo file /opt/glite/etc/config/glite-lb.cfg.xml
+               echo files /opt/glite/etc/config/glite-lb.cfg.xml
+               echo and /opt/glite/etc/config/glite-global.cfg.xml
                echo and run the configuration script
                echo /opt/glite/etc/config/scripts/glite-lb-config.py.
                echo A template is provided in
                echo /opt/glite/etc/config/templates/glite-lb.cfg.xml
+               echo Alternatively site configuration files can be used
        else
                echo
                echo An error occurred while installing the LB RPMS.
@@ -153,7 +155,7 @@ function install()
        echo For more information refer to the gLite Installation and User Guides
        echo or to the gLite web site \(http:\/\/www.glite.org\)
        echo Please report problems and comments to the gLite Team at
-       echo project-eu-egee-glite-bugs@cern.ch
+       echo glite-bugs@cern.ch
 
        cd ..
 }
index 08bf106..a7c9c63 100644 (file)
@@ -1,4 +1,4 @@
 
-module.version = 2.0.0
+module.version = 2.0.1
 module.age = 1
                                
\ No newline at end of file