[Checkins] SVN: zc.zodbrecipes/trunk/ New Features

Jim Fulton jim at zope.com
Mon Nov 3 14:18:23 EST 2008


Log message for revision 92760:
  New Features
  ------------
  
  You can now specify a name option in server parts to have installed
  files use a different name than the section name.
  
  Bugs Fixed
  ----------
  
  Pack crontab files weren't removed when parts were removed or renamed.
  

Changed:
  U   zc.zodbrecipes/trunk/README.txt
  U   zc.zodbrecipes/trunk/zc/zodbrecipes/__init__.py
  U   zc.zodbrecipes/trunk/zc/zodbrecipes/zeo.txt

-=-
Modified: zc.zodbrecipes/trunk/README.txt
===================================================================
--- zc.zodbrecipes/trunk/README.txt	2008-11-03 15:57:19 UTC (rev 92759)
+++ zc.zodbrecipes/trunk/README.txt	2008-11-03 19:18:21 UTC (rev 92760)
@@ -9,6 +9,20 @@
 Changes
 *******
 
+0.5.0 (2008-11-03)
+================
+
+New Features
+------------
+
+You can now specify a name option in server parts to have installed
+files use a different name than the section name.
+
+Bugs Fixed
+----------
+
+Pack crontab files weren't removed when parts were removed or renamed.
+
 0.4 (2008-02-18)
 ================
 

Modified: zc.zodbrecipes/trunk/zc/zodbrecipes/__init__.py
===================================================================
--- zc.zodbrecipes/trunk/zc/zodbrecipes/__init__.py	2008-11-03 15:57:19 UTC (rev 92759)
+++ zc.zodbrecipes/trunk/zc/zodbrecipes/__init__.py	2008-11-03 19:18:21 UTC (rev 92760)
@@ -23,7 +23,7 @@
 class StorageServer:
 
     def __init__(self, buildout, name, options):
-        self.name, self.options = name, options
+        self.name, self.options = options.get('name', name), options
 
         deployment = self.deployment = options.get('deployment')
         if deployment:
@@ -35,7 +35,7 @@
             options['etc-directory'] = buildout[deployment]['etc-directory']
             options['logrotate'] = os.path.join(
                 buildout[deployment]['logrotate-directory'],
-                options['deployment-name'] + '-' + name)
+                options['deployment-name'] + '-' + self.name)
             options['crontab-directory'] = buildout[
                 deployment]['crontab-directory']
             options['user'] = buildout[deployment]['user']
@@ -95,11 +95,10 @@
                 conf=zdaemon_conf_path,
                 ))
 
+            options.created(zeo_conf_path, zdaemon_conf_path, logrotate,
+                            os.path.join(options['rc-directory'], rc),
+                            )
 
-            creating = [zeo_conf_path, zdaemon_conf_path, logrotate,
-                        os.path.join(options['rc-directory'], rc),
-                        ]
-
             pack = options.get('pack')
             if pack:
                 pack = pack.split()
@@ -122,9 +121,9 @@
             event_log_path = os.path.join(run_directory, 'zeo.log')
             socket_path = os.path.join(run_directory, 'zdaemon.sock')
             rc = self.name
-            creating = [run_directory,
-                        os.path.join(options['rc-directory'], rc),
-                        ]
+            options.created(run_directory,
+                            os.path.join(options['rc-directory'], rc),
+                            )
             if not os.path.exists(run_directory):
                 os.mkdir(run_directory)
             pack = pack_path = None
@@ -253,8 +252,9 @@
                             options['zeopack'], address, storage, days,
                             ))
                 f.close()
+                options.created(pack_path)
 
-            return creating
+            return options.created()
 
         except:
             for f in creating:

Modified: zc.zodbrecipes/trunk/zc/zodbrecipes/zeo.txt
===================================================================
--- zc.zodbrecipes/trunk/zc/zodbrecipes/zeo.txt	2008-11-03 15:57:19 UTC (rev 92759)
+++ zc.zodbrecipes/trunk/zc/zodbrecipes/zeo.txt	2008-11-03 19:18:21 UTC (rev 92760)
@@ -25,7 +25,7 @@
     ... ''')
 
 Here we specified a minimal configuration using a "foo" storage.  We
-can use aby kind of storage we want.  Here we ised an import statement
+can use any kind of storage we want.  Here we used an import statement
 to import the schema definition that defined the foo section.  Any
 imports are simply copied to the generated configuration file.  When
 we run the buildout:
@@ -548,7 +548,6 @@
     ... shell-script = true
     ...
     ... [demo]
-    ... name = Demo
     ... crontab-directory = %(cron)s
     ... etc-directory = %(etc)s
     ... log-directory = %(log)s
@@ -564,9 +563,76 @@
     Installing zdaemon.
     Generated script '/sample-buildout/bin/zdaemon'.
     Installing server.
-    zc.zodbrecipes: Generated shell script '/sample-buildout/rc/Demo-server'.
+    zc.zodbrecipes: Generated shell script '/sample-buildout/rc/demo-server'.
 
-    >>> cat('rc', 'Demo-server')
+    >>> cat('rc', 'demo-server')
     #!/bin/sh
     su bob -c \
       "/sample-buildout/bin/zdaemon -C '/sample-buildout/etc/server-zdaemon.conf' $*"
+
+Names
+=====
+
+Names can be specified for deployments and for individual server
+parts. These names determine names of files generated.
+
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... parts = zodb zdaemon server
+    ... 
+    ... [zodb]
+    ... recipe = zc.recipe.egg:script
+    ... eggs = ZODB3
+    ... 
+    ... [zdaemon]
+    ... recipe = zc.recipe.egg:script
+    ... eggs = zdaemon
+    ... 
+    ... [server]
+    ... name = Server
+    ... recipe = zc.zodbrecipes:server
+    ... zeo.conf = 
+    ...    <zeo>
+    ...       address 8100
+    ...       monitor-address 8101
+    ...       transaction-timeout 300
+    ...    </zeo>
+    ...    %%import foo
+    ...    <foo main>
+    ...       path /databases/Data.fs
+    ...    </foo>
+    ... deployment = demo
+    ... pack = 1 1 * * 0 3 jim at zope.com
+    ... shell-script = true
+    ...
+    ... [demo]
+    ... name = Demo
+    ... crontab-directory = %(cron)s
+    ... etc-directory = %(etc)s
+    ... log-directory = %(log)s
+    ... logrotate-directory = %(rotate)s
+    ... rc-directory = %(rc)s
+    ... run-directory = %(run)s
+    ... user = bob
+    ... ''' % globals())
+
+    >>> print system(buildout+' -D'),
+    Uninstalling server.
+    Updating zodb.
+    Updating zdaemon.
+    Installing server.
+    zc.zodbrecipes: Generated shell script '/sample-buildout/rc/Demo-Server'.
+
+    >>> ls(cron)
+    -  pack-Demo-Server
+
+    >>> ls(etc)
+    -  Server-zdaemon.conf
+    -  Server-zeo.conf
+
+    >>> ls(rotate)
+    -  Demo-Server
+
+    >>> ls(rc)
+    -  Demo-Server



More information about the Checkins mailing list