[Checkins] SVN: zc.zodbrecipes/trunk/ Bug Fixed

Jim Fulton jim at zope.com
Tue May 25 15:13:01 EDT 2010


Log message for revision 112714:
  Bug Fixed
    Pack scripts were incorrectly generated for storages that weren't
    named in their storage configurations.
  

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	2010-05-25 17:37:27 UTC (rev 112713)
+++ zc.zodbrecipes/trunk/README.txt	2010-05-25 19:13:01 UTC (rev 112714)
@@ -9,6 +9,15 @@
 Changes
 *******
 
+0.6.1 (2010-05-25)
+==================
+
+Bugs Fixed
+----------
+
+- Pack scripts were incorrectly generated for storages that weren't
+  named in their storage configurations.
+
 0.6.0 (2009-12-03)
 ==================
 

Modified: zc.zodbrecipes/trunk/zc/zodbrecipes/__init__.py
===================================================================
--- zc.zodbrecipes/trunk/zc/zodbrecipes/__init__.py	2010-05-25 17:37:27 UTC (rev 112713)
+++ zc.zodbrecipes/trunk/zc/zodbrecipes/__init__.py	2010-05-25 19:13:01 UTC (rev 112714)
@@ -100,7 +100,7 @@
                 zdaemon_conf_path,
                 os.path.join(options['rc-directory'], rc),
                 )
-            
+
             logrotate = options['logrotate']
             if logrotate:
                 open(logrotate, 'w').write(logrotate_template % dict(
@@ -157,7 +157,7 @@
         if not 'address' in zeo_section:
             raise zc.buildout.UserError('No ZEO address was specified.')
 
-        storages = [s.name for s in zeo_conf.sections
+        storages = [s.name or '1' for s in zeo_conf.sections
                     if s.type not in ('zeo', 'eventlog', 'runner')
                     ]
 

Modified: zc.zodbrecipes/trunk/zc/zodbrecipes/zeo.txt
===================================================================
--- zc.zodbrecipes/trunk/zc/zodbrecipes/zeo.txt	2010-05-25 17:37:27 UTC (rev 112713)
+++ zc.zodbrecipes/trunk/zc/zodbrecipes/zeo.txt	2010-05-25 19:13:01 UTC (rev 112714)
@@ -3,23 +3,23 @@
 
 The zc.zodbrecipes:server recipe can be used to define ZEO storage
 servers. To define a storage server, you define a part for the server
-and specify configuration data.  
+and specify configuration data.
 
     >>> write('buildout.cfg',
     ... '''
     ... [buildout]
     ... parts = server
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... ''')
@@ -30,9 +30,9 @@
 imports are simply copied to the generated configuration file.  When
 we run the buildout:
 
-    >>> print system(buildout),
+    >>> print system(buildout), # doctest: +NORMALIZE_WHITESPACE
     Installing server.
-    zc.zodbrecipes: 
+    zc.zodbrecipes:
     A runzeo script couldn't be found at:
     <BLANKLINE>
       '/sample-buildout/bin/runzeo'
@@ -51,21 +51,21 @@
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... ''')
@@ -102,7 +102,7 @@
       transaction-timeout 300
     </zeo>
     <BLANKLINE>
-    <foo main>
+    <foo>
       path /databases/Data.fs
     </foo>
     <BLANKLINE>
@@ -121,21 +121,21 @@
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ...    <eventlog>
@@ -160,7 +160,7 @@
       transaction-timeout 300
     </zeo>
     <BLANKLINE>
-    <foo main>
+    <foo>
       path /databases/Data.fs
     </foo>
     <BLANKLINE>
@@ -176,21 +176,21 @@
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... ''')
@@ -250,29 +250,29 @@
 Specifying additional eggs
 ==========================
 
-You can specify additional eggs to be installed for use by the 
+You can specify additional eggs to be installed for use by the
 zdaemon script:
 
     >>> write('buildout.cfg',
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
     ... eggs = zope.event
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... ''')
@@ -283,7 +283,7 @@
     Installing server.
     Generated script '/sample-buildout/bin/server'.
 
-We can see the zope.event egg present in the control script 
+We can see the zope.event egg present in the control script
 generated in our bin directory:
 
     >>> cat('bin', 'server')
@@ -348,21 +348,21 @@
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %%import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... deployment = demo
@@ -460,28 +460,28 @@
 their part names.  Also note that the deployment user is set in the
 zdaemon configuration.
 
-If you want to manage your own log rotation, you can place "logrotate = false" 
+If you want to manage your own log rotation, you can place "logrotate = false"
 in your deployment section to prevent the logrotate config being generated:
 
     >>> write('buildout.cfg',
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %%import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... deployment = demo
@@ -515,21 +515,21 @@
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %%import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... deployment = demo
@@ -570,21 +570,21 @@
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %%import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... deployment = demo
@@ -609,8 +609,50 @@
 Now, we'll get a crontab file:
 
     >>> cat(cron, 'pack-demo-server')
-    1 1 * * 0 bob /sample-buildout/bin/zeopack -p 8100 -S main -d 3
+    1 1 * * 0 bob /sample-buildout/bin/zeopack -p 8100 -S 1 -d 3
 
+.. Make sure it works to supply a storage name:
+
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... parts = zodb server
+    ...
+    ... [zodb]
+    ... recipe = zc.recipe.egg:script
+    ... eggs = ZODB3
+    ...
+    ... [server]
+    ... recipe = zc.zodbrecipes:server
+    ... zeo.conf =
+    ...    <zeo>
+    ...       address 8100
+    ...       monitor-address 8101
+    ...       transaction-timeout 300
+    ...    </zeo>
+    ...    %%import foo
+    ...    <foo x>
+    ...       path /databases/Data.fs
+    ...    </foo>
+    ... deployment = demo
+    ... pack = 1 1 * * 0 3
+    ...
+    ... [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())
+
+    >>> _ = system(buildout+' -D'),
+
+    >>> cat(cron, 'pack-demo-server')
+    1 1 * * 0 bob /sample-buildout/bin/zeopack -p 8100 -S x -d 3
+
+
 In this example, we'll pack the databases every Sunday at 1:01 to 3
 days.
 
@@ -621,21 +663,21 @@
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %%import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... deployment = demo
@@ -659,7 +701,7 @@
 
     >>> cat(cron, 'pack-demo-server')
     MAILTO=jim at zope.com
-    1 1 * * 0 bob /sample-buildout/bin/zeopack -p 8100 -S main -d 3
+    1 1 * * 0 bob /sample-buildout/bin/zeopack -p 8100 -S 1 -d 3
 
 This causes email to be sent to the given address, rather than to the
 user specified in the crontab file.
@@ -682,25 +724,25 @@
     ... '''
     ... [buildout]
     ... parts = zodb zdaemon server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [zdaemon]
     ... recipe = zc.recipe.egg:script
     ... eggs = zdaemon
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %%import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... deployment = demo
@@ -740,26 +782,26 @@
     ... '''
     ... [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.conf =
     ...    <zeo>
     ...       address 8100
     ...       monitor-address 8101
     ...       transaction-timeout 300
     ...    </zeo>
     ...    %%import foo
-    ...    <foo main>
+    ...    <foo>
     ...       path /databases/Data.fs
     ...    </foo>
     ... deployment = demo
@@ -807,14 +849,14 @@
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    nothing useful
     ... ''')
 
@@ -831,14 +873,14 @@
     ... '''
     ... [buildout]
     ... parts = zodb server
-    ... 
+    ...
     ... [zodb]
     ... recipe = zc.recipe.egg:script
     ... eggs = ZODB3
-    ... 
+    ...
     ... [server]
     ... recipe = zc.zodbrecipes:server
-    ... zeo.conf = 
+    ... zeo.conf =
     ...    <bad
     ... ''')
 



More information about the checkins mailing list