From 2dc9111457e7fc7ccf82d960a0ef4a9ca313b45a Mon Sep 17 00:00:00 2001 From: Alberto Di Meglio Date: Fri, 19 Aug 2005 12:46:47 +0000 Subject: [PATCH] Fixed various mysql set up problems --- .../config/scripts/glite-lb-config.py | 34 +++++++++++++++++----- .../config/templates/glite-lb.cfg.xml | 23 +++++---------- org.glite.deployment.lb/project/lxscript-rpm.xsl | 6 ++-- org.glite.deployment.lb/project/version.properties | 2 +- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/org.glite.deployment.lb/config/scripts/glite-lb-config.py b/org.glite.deployment.lb/config/scripts/glite-lb-config.py index 61f5e5c..681185e 100644 --- a/org.glite.deployment.lb/config/scripts/glite-lb-config.py +++ b/org.glite.deployment.lb/config/scripts/glite-lb-config.py @@ -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: diff --git a/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml b/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml index 0eeb26d..72ada69 100644 --- a/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml +++ b/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml @@ -17,6 +17,10 @@ parameter. Leave it empty of comment it out to use the same as 'glite.user.name'" value="changeme"/> + + @@ -30,12 +34,10 @@ description="Enable check of host certificates" value="true"/> - - - + + + + @@ -45,15 +47,6 @@ - - - - - - diff --git a/org.glite.deployment.lb/project/lxscript-rpm.xsl b/org.glite.deployment.lb/project/lxscript-rpm.xsl index e20f297..0bf5cc8 100644 --- a/org.glite.deployment.lb/project/lxscript-rpm.xsl +++ b/org.glite.deployment.lb/project/lxscript-rpm.xsl @@ -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 .. } diff --git a/org.glite.deployment.lb/project/version.properties b/org.glite.deployment.lb/project/version.properties index 08bf106..a7c9c63 100644 --- a/org.glite.deployment.lb/project/version.properties +++ b/org.glite.deployment.lb/project/version.properties @@ -1,4 +1,4 @@ -module.version = 2.0.0 +module.version = 2.0.1 module.age = 1 \ No newline at end of file -- 1.8.2.3