Index: /main/waeup.stress/trunk/src/waeup/stress/__init__.py
===================================================================
--- /main/waeup.stress/trunk/src/waeup/stress/__init__.py	(revision 8688)
+++ /main/waeup.stress/trunk/src/waeup/stress/__init__.py	(revision 8689)
@@ -4,5 +4,5 @@
 import sys
 import time
-import waeup.kofa
+#import waeup.kofa
 
 AVAILABLE_KOFA_PROJECTS = ['waeup.kofa',]
@@ -10,17 +10,23 @@
 kofa_projects = dict()
 
-for pkg_name in AVAILABLE_KOFA_PROJECTS:
+root = os.path.dirname(os.path.dirname(os.path.dirname(
+    os.path.dirname(__file__))))
+instances_root = os.path.join(root, 'instances')
+instances = dict()
+print "ROOT: ", root
+for pkg_name in os.listdir(instances_root):
     try:
+        if pkg_name.startswith('.') or '.' not in pkg_name:
+            continue
+        path_ = os.path.join(instances_root, pkg_name)
+        if not os.path.isdir(path_):
+            continue
         name = pkg_name.split('.')[-1]
-        mod = sys.modules[pkg_name].__file__
-        packages[name] = os.path.dirname(mod)
-        kofa_projects[name] = os.path.dirname(os.path.dirname(os.path.dirname(
-            packages[name])))
+        instances[name] = path_
     except:
         # not a package
         pass
 
-print "PACKAGES: ", packages
-print "KOFA PROJECTS: ", kofa_projects
+print "WAEUP.STRESS.INIT: INSTANCES: ", instances
 
 def do_foo():
@@ -38,5 +44,5 @@
     """Run bootstrap and buildout for each of the KOFA instances
     """
-    for name, path in kofa_projects.items():
+    for name, path in instances.items():
         bootstrap_instance(name, path)
     return
@@ -57,5 +63,5 @@
 
 def remove_zodb(name):
-    path = kofa_projects[name]
+    path = instances[name]
     print "WAEUP.STRESS: removing ZODB of %s at %s" % (name, path)
     filestorage_dir = os.path.join(path, 'var', 'filestorage')
@@ -78,5 +84,5 @@
     instance.
     """
-    path = kofa_projects[name]
+    path = instances[name]
     print "WAEUP.STRESS: starting instance %s at %s using %s" % (
         name, path, mode),
@@ -121,5 +127,5 @@
     use to stop the instance.
     """
-    path = kofa_projects[name]
+    path = instances[name]
     print "WAEUP.STRESS: shutting down instance %s at %s using %s" % (
         name, path, mode),
@@ -141,19 +147,9 @@
 
 def install_app(name):
-    path = kofa_projects[name]
+    """Execute waeup.stress.script in instance context.
+    """
+    path = instances[name]
     old_cwd_ = os.getcwd()
     os.chdir(path)
-    db_file = os.path.join(path, 'var', 'filestorage', 'Data.fs')
-    config_file = os.path.join(path, 'parts', 'etc', 'site.zcml')
-    #import waeup.kofa.meta
-    #import grok.meta
-    import grok
-    #print "META: ", grok.meta
-    import sys
-    #print "PATHS: ", sys.path
-    from zope.app.appsetup import database, config
-    #config(config_file)
-    #subprocess.call(
-    #    './bin/python-console -c "import grok.meta"', shell=True)
     script = os.path.join(os.path.dirname(__file__), 'scripts.py')
     subprocess.call(
