Added verification of GLITE_USER
authorAlberto Di Meglio <alberto.di.meglio@cern.ch>
Fri, 3 Dec 2004 15:14:23 +0000 (15:14 +0000)
committerAlberto Di Meglio <alberto.di.meglio@cern.ch>
Fri, 3 Dec 2004 15:14:23 +0000 (15:14 +0000)
org.glite.deployment.lb/config/scripts/glite-lb-config.py
org.glite.deployment.lb/config/templates/glite-lb.cfg.xml

index 83af475..173ca7a 100644 (file)
@@ -101,14 +101,29 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
         mysql.start()
         os.system('%s/etc/init.d/glite-lb-bkserverd start' % os.environ['GLITE_LOCATION'])
         
+        return 0
+        
     def stop(self):
         os.system('%s/etc/init.d/glite-lb-bkserverd stop' % os.environ['GLITE_LOCATION'])
         mysql.stop()
         
+        return 0
+        
     def configure(self):
-        mysql.start()
+        
+        # Create the GLITE_USER if it doesn't exists
+        print "Creating/Verifying the GLITE_USER account %s" % os.environ['GLITE_USER']
+        (uid,gid) = glib.get_user_info(os.environ['GLITE_USER'])
+        if uid == -1:
+            glib.add_user(os.environ['GLITE_USER'],os.environ['GLITE_USER'])
+        (uid,gid) = glib.get_user_info(os.environ['GLITE_USER'])
+        glib.check_dir(os.environ['GLITE_LOCATION_VAR'],0755, uid, gid)
         
         # Create the MySQL database
+        mysql.stop()
+        time.sleep(5)
+        mysql.start()
+        
         print '#-------------------------------------------------------------------'
         print ('Creating MySQL %s database.' % params['lb.database.name'])
         print '#-------------------------------------------------------------------'
@@ -129,6 +144,8 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
         time.sleep(5)
         mysql.start()
         
+        return 0
+        
 #-------------------------------------------------------------------------------
 # Set all environment variables
 #-------------------------------------------------------------------------------
@@ -149,6 +166,7 @@ def set_env():
 
     glib.export('GLITE_HOST_CERT',params['host.certificate.file'])
     glib.export('GLITE_HOST_KEY',params['host.key.file'])
+    glib.export('GLITE_USER','glite')
     glib.export('GLOBUS_LOCATION',params['GLOBUS_LOCATION'])
 
     # bin and lib paths
@@ -236,6 +254,7 @@ if __name__ == '__main__':
         sys.exit(1)
         
     # Start the service
+    service.stop()
     if service.start() != 0:
         print "An error occurred while starting the %s" % service.friendly_name
         sys.exit(1)
index 0540de6..5146ca6 100644 (file)
                        description="The location of the Globus Toolkit"
                        value="/opt/globus"/>
                        
+               <GLITE_USER
+                       description="The account used to run the LB daemons"
+                       value="glite"/>
+                       
                <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
                <!-- System parameters - You should leave these alone -->
                <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->