Skip to content

Commit

Permalink
Ensure activity plugin is loaded before migrating old revisions
Browse files Browse the repository at this point in the history
Otherwise you get an `package_activity_list` action not found error
  • Loading branch information
amercader committed Jun 29, 2023
1 parent 8d0d3b3 commit 888ac27
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ckan/migration/migrate_package_activity.py
Expand Up @@ -32,6 +32,7 @@
import argparse
from collections import defaultdict
from typing import Any
import sys


# not importing anything from ckan until after the arg parsing, to fail on bad
Expand Down Expand Up @@ -274,6 +275,8 @@ def print_errors(errors):
args = parser.parse_args()
assert args.config, u'You must supply a --config'
print(u'Loading config')

from ckan.plugins import plugin_loaded
try:
from ckan.cli import load_config
from ckan.config.middleware import make_app
Expand All @@ -291,6 +294,11 @@ class Options(object):
cmd._load_config()
return
load_config(args.config)

if not plugin_loaded("activity"):
print("Please add the `activity` plugin to your `ckan.plugins` setting")
sys.exit(1)

if not args.dataset:
migrate_all_datasets()
wipe_activity_detail(delete_activity_detail=args.delete)
Expand Down

0 comments on commit 888ac27

Please sign in to comment.