Skip to content

Commit

Permalink
Add option to dump current schemas to bundle loader
Browse files Browse the repository at this point in the history
  • Loading branch information
XenoY committed Sep 10, 2024
1 parent 5fb08e0 commit 734292b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/TI-948.other
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add option to regenerate bundle schemas on bundle import [TI-948](https://4teamwork.atlassian.net/browse/TI-948)
6 changes: 5 additions & 1 deletion docker/core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ RUN --mount=type=cache,target=/root/.cache \
RUN find /app/opengever -name "*.po" | xargs -I@ sh -c 'msgfmt @ -o "$(dirname @)/$(basename @ .po)".mo' && \
find /app/plonetheme -name "*.po" | xargs -I@ sh -c 'msgfmt @ -o "$(dirname @)/$(basename @ .po)".mo'

# Plone needs permissions to update bundle schemas on import
RUN chown plone:plone /app/opengever/bundle/schemas && \
chown plone:plone /app/opengever/bundle/schemas/*

COPY ./docker/core/etc /app/etc
RUN chown -R plone:plone /app/etc
COPY ./docker/core/entrypoint.d /app/entrypoint.d
Expand All @@ -88,7 +92,7 @@ RUN mkdir -p /app/var/log /app/var/instance \

RUN ln -sf /dev/null /app/var/log/upgrade_stats.csv

# Patch cacert.pem with a recent version to address CVE-2023-37920
# Patch cacert.pem with a recent version to address CVE-2023-37920
RUN wget -O /app/lib/python2.7/site-packages/certifi/cacert.pem https://raw.githubusercontent.com/certifi/python-certifi/2024.02.02/certifi/cacert.pem

# Patch ftw.bumblebee to use time.time() for timestamp generation
Expand Down
9 changes: 9 additions & 0 deletions opengever/bundle/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from Products.Archetypes import atapi # noqa # isort:skip
from opengever.base.interfaces import IOpengeverBaseLayer
from opengever.base.pathfinder import PathFinder
from opengever.base.schemadump.schema import dump_oggbundle_schemas
from opengever.base.schemadump.schema import OGGBundleJSONSchemaDumpWriter
from opengever.bundle.config.importer import ConfigImporter
from opengever.bundle.importer import BundleImporter
from opengever.core.debughelpers import get_first_plone_site
Expand Down Expand Up @@ -33,6 +35,8 @@ def parse_args(argv):
help="Don't to intermediate commits")
parser.add_argument('--no-check-unique-principals', action='store_true',
help="Don't to check for OGDS principal name uniqueness")
parser.add_argument('--rebuild-schemas', action='store_true',
help="Rebuild schemas with current schemas")

args = parser.parse_args(argv)
return args
Expand Down Expand Up @@ -60,6 +64,11 @@ def import_oggbundle(app, args):

import_config_from_bundle(app, args)

if args.rebuild_schemas:
log.info('Generating and dumping latest OGGBundle JSON Schemas')
writer = OGGBundleJSONSchemaDumpWriter()
writer.dump()

importer = BundleImporter(
plone,
args.bundle_path,
Expand Down

0 comments on commit 734292b

Please sign in to comment.