From 58edac61effce861eb675152bd2f3972cb696bb4 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Fri, 19 Apr 2019 20:36:37 -0500 Subject: [PATCH] Add ability to turn off ``zodb-temporary-storage`` to prevent Zope 4 breakage --- README.rst | 4 +- news/87.bugfix | 1 + src/plone/recipe/zope2instance/recipe.py | 7 ++- .../zope2instance/tests/zope2instance.txt | 56 +++++++++++++++++++ 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 news/87.bugfix diff --git a/README.rst b/README.rst index 3f900c79..616ec8c7 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/news/87.bugfix b/news/87.bugfix new file mode 100644 index 00000000..94b4ac49 --- /dev/null +++ b/news/87.bugfix @@ -0,0 +1 @@ +Add ability to turn off ``zodb-temporary-storage`` to prevent Zope 4 breakage diff --git a/src/plone/recipe/zope2instance/recipe.py b/src/plone/recipe/zope2instance/recipe.py index 447bbbb3..005b8709 100644 --- a/src/plone/recipe/zope2instance/recipe.py +++ b/src/plone/recipe/zope2instance/recipe.py @@ -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( diff --git a/src/plone/recipe/zope2instance/tests/zope2instance.txt b/src/plone/recipe/zope2instance/tests/zope2instance.txt index 56a5515e..c04feff9 100644 --- a/src/plone/recipe/zope2instance/tests/zope2instance.txt +++ b/src/plone/recipe/zope2instance/tests/zope2instance.txt @@ -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 + + # Main database + cache-size 30000 + # Blob-enabled FileStorage database + + blob-dir .../sample-buildout/var/blobstorage + # FileStorage database + + path .../sample-buildout/var/filestorage/Data.fs + + + mount-point / + + python-check-interval 1000 + + DemoStorage ===========