Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to turn off zodb-temporary-storage to prevent Zope 4 breakage #93

Merged
merged 1 commit into from
Apr 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@ zodb-cache-size-bytes

zodb-temporary-storage
If given Zope's default temporary storage definition will be replaced by
the lines of this parameter.
the lines of this parameter. If set to "off" or "false", no temporary storage
definition will be created. This prevents startup issues for basic Zope 4
sites as it does not ship with the required packages by default anymore.

zope-conf
A relative or absolute path to a `zope.conf` file. If this is given, many of
Expand Down
1 change: 1 addition & 0 deletions news/87.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ability to turn off ``zodb-temporary-storage`` to prevent Zope 4 breakage
7 changes: 5 additions & 2 deletions src/plone/recipe/zope2instance/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,11 @@ def is_rs_option(name):
storage_snippet = indent(
options['storage-wrapper'] % storage_snippet, 4)

zodb_tmp_storage = options.get('zodb-temporary-storage',
zodb_temporary_storage_template)
zodb_tmp_storage = options.get('zodb-temporary-storage', 'on')
if zodb_tmp_storage.lower() in ('off', 'false', '0'):
zodb_tmp_storage = ''
else:
zodb_tmp_storage = zodb_temporary_storage_template
template = wsgi_conf_template if self.wsgi else zope_conf_template

pid_file = options.get(
Expand Down
56 changes: 56 additions & 0 deletions src/plone/recipe/zope2instance/tests/zope2instance.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,62 @@ FTP and WebDAV
With wsgi there is no FTP and WebDAV. Use Python 2 and ``wsgi = off`` for that.


Turning off ZODB temporary storage
==================================
Zope 4 does not ship with the required packages anymore, so to avoid breakage
the creation of the ZODB temporary storage definition can be turned off:

>>> write('buildout.cfg',
... '''
... [buildout]
... parts = instance
... find-links = %(sample_buildout)s/eggs
...
... [instance]
... recipe = plone.recipe.zope2instance
... eggs =
... user = me:me
... zodb-temporary-storage = off
... ''' % options)

Let's run it::

>>> print(system(join('bin', 'buildout'))),
Uninstalling instance.
Installing instance.
Generated script '...instance'.
Generated interpreter '.../parts/instance/bin/interpreter'...

The generated configuration has no temporary storage section anymore:

>>> instance = os.path.join(sample_buildout, 'parts', 'instance')
>>> zope_conf = open(os.path.join(instance, 'etc', 'zope.conf')).read()
>>> zope_conf = zope_conf.replace('\\', '/')
>>> print(zope_conf)
%define INSTANCEHOME .../sample-buildout/parts/instance
instancehome $INSTANCEHOME
%define CLIENTHOME .../sample-buildout/var/instance
clienthome $CLIENTHOME
debug-mode off
security-policy-implementation C
verbose-security off
default-zpublisher-encoding utf-8
<zodb_db main>
# Main database
cache-size 30000
# Blob-enabled FileStorage database
<blobstorage>
blob-dir .../sample-buildout/var/blobstorage
# FileStorage database
<filestorage>
path .../sample-buildout/var/filestorage/Data.fs
</filestorage>
</blobstorage>
mount-point /
</zodb_db>
python-check-interval 1000


DemoStorage
===========

Expand Down