Overridable Resources Bug

The builds for Thursday and Friday (Feb 14/15) introduced an ‘overridable’ attribute on resources that controls whether or not that resource can be overridden by a child project.

Unfortunately there was a bug that resulted in all resources being overridable=false on upgrade (from 8.0 beta to beta, not from 7.9) rather than overridable=true as the default should be.

If you find yourself affected by this and you can’t just restore your previous backup to a build from today forward then you might be able to repair the situation running this script from the data dir or passing the full path to the data/project dir as the first argument.

Built and tested with Python 3.x, not sure it it will work on 2.x. Make a copy of your data projects directory before running it just in case.

#!/usr/bin/python

import json
import os
import sys

def fix_override(manifest_path):
    print("fixing manifest at path: " + manifest_path)

    with open(manifest_path, 'r+') as manifest_file:
        manifest = json.load(manifest_file)
        manifest["overridable"] = True

        manifest_file.seek(0)
        json.dump(manifest, manifest_file, indent=2)
        manifest_file.truncate()

project_dir = sys.argv[1] if len(sys.argv) == 2 else './projects'
print("fixing manifests in project dir: " + project_dir)

for dirpath, dirnames, filenames in os.walk(project_dir):
    for filename in filenames:
        if filename == "resource.json":
            manifest_path = os.path.join(dirpath, filename)
            fix_override(manifest_path)

The bug is fixed in the most recent (Feb 16) build.

2 Likes