[Erp5-report] r11553 - /erp5/trunk/utils/oood/start.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Nov 30 18:13:31 CET 2006


Author: kevin
Date: Thu Nov 30 18:13:30 2006
New Revision: 11553

URL: http://svn.erp5.org?rev=11553&view=rev
Log:
Save OOo instance config in oood run home (= run_dir, = /var/run/oood).
Delete bad X11 socket to let Xvfb start in case of bad permissions.
Fix deleted variable.

Modified:
    erp5/trunk/utils/oood/start.py

Modified: erp5/trunk/utils/oood/start.py
URL: http://svn.erp5.org/erp5/trunk/utils/oood/start.py?rev=11553&r1=11552&r2=11553&view=diff
==============================================================================
--- erp5/trunk/utils/oood/start.py (original)
+++ erp5/trunk/utils/oood/start.py Thu Nov 30 18:13:30 2006
@@ -78,7 +78,7 @@
                  , '-nodefault'
                  , '-norestore'
                  , '-accept=socket,host=%s,port=%d;urp;' % (config.pool_host, instance_port)
-                 , '-env:UserInstallation=$SYSUSERCONFIG/./tmp/oood_instance_%d' % i
+                 , '-env:UserInstallation=$SYSUSERCONFIG/./oood_instance_%d' % i
                  , new_context
                  ]
   pid = os.spawnlpe(os.P_NOWAIT, cmd, *args_and_env)
@@ -152,8 +152,19 @@
   """
     This method start a virtual frame buffer (Xvfb)
   """
+  VIRTUAL_SCREEN = 0
+  XORG_TMP_PATH  = "/tmp/.X11-unix"
+  OOOD_USER_NAME = "oood"
+  # Clean previous virtual display if found
   killVirtualFrameBuffer()
-  VIRTUAL_SCREEN = 0
+  # Remove bad previous socket
+  xorg_socket = os.path.join(XORG_TMP_PATH, 'X' % config.virtual_display_id)
+  if os.path.exists(xorg_socket) and \
+    (os.stat(xorg_socket).st_uid != int(commands.getoutput("id -u %s" % OOOD_USER_NAME)) or \
+     os.stat(xorg_socket).st_gid != int(commands.getoutput("id -g %s" % OOOD_USER_NAME))):
+    os.remove(xorg_socket)
+    lib.log("Pool - '%s' removed because of bad permissions", 0)
+  # Start the new virtual display server
   os.system("Xvfb -ac :%s -screen %s 800x600x16 -fbdir %s &" % ( config.virtual_display_id
                                                                , VIRTUAL_SCREEN
                                                                , config.run_dir
@@ -171,7 +182,7 @@
   # Search the running process
   killed = False
   for process in result[1].splitlines():
-    if process.find(virtual_display_cmd) != -1 and process.find('grep') == -1:
+    if process.find('grep') == -1:
       pid = int(process.strip().split(' ')[0])
       os.kill(pid, 9)
       killed = True




More information about the Erp5-report mailing list