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

Error trying to delete a reference with an empty source during upgrade to Plone 5 #32

Closed
fulv opened this issue Dec 8, 2015 · 3 comments

Comments

@fulv
Copy link
Member

fulv commented Dec 8, 2015

I'm running an upgrade from 4.0.10 to 5.0, via an intermediate 4.3.7 step. While on 4.3.7 I migrate all content to plone.app.contenttypes before starting the 5.0 upgrade.

On 5.0, the upgrade fails with the following traceback:

2015-12-07 22:40:56 ERROR plone.app.upgrade Upgrade aborted. Error:
Traceback (most recent call last):
  File "/Users/fulvio/Downloads/Plone-5.0/buildout-cache/eggs/Products.CMFPlone-5.0-py2.7.egg/Products/CMFPlone/MigrationTool.py", line 257, in upgrade
    step['step'].doStep(setup)
  File "/Users/fulvio/Downloads/Plone-5.0/buildout-cache/eggs/Products.GenericSetup-1.8.0-py2.7.egg/Products/GenericSetup/upgrade.py", line 166, in doStep
    self.handler(tool)
  File "/Users/fulvio/Downloads/Plone-5.0/buildout-cache/eggs/plone.app.upgrade-1.3.18-py2.7.egg/plone/app/upgrade/v50/betas.py", line 353, in to50rc1
    migrate_linkintegrity_relations(portal)
  File "/Users/fulvio/Downloads/Plone-5.0/buildout-cache/eggs/plone.app.linkintegrity-3.0.2-py2.7.egg/plone/app/linkintegrity/upgrades.py", line 21, in migrate_linkintegrity_relations
    source_obj, target_obj, relationship=referencedRelationship)
  File "/Users/fulvio/Downloads/Plone-5.0/buildout-cache/eggs/Products.Archetypes-1.10.10-py2.7.egg/Products/Archetypes/ReferenceEngine.py", line 343, in deleteReference
    sID, sobj = self._uidFor(source)
  File "/Users/fulvio/Downloads/Plone-5.0/buildout-cache/eggs/Products.Archetypes-1.10.10-py2.7.egg/Products/Archetypes/ReferenceEngine.py", line 533, in _uidFor
    raise ReferenceException, "%r not referenceable" % uobject
ReferenceException: None not referenceable

In the plone.app.linkintegrity.upgrades.migrate_linkintegrity_relations call, brain has two non-empty values for sourceUID and targetUID, but uuidToObject(brain.sourceUID) produces None, while uuidToObject(brain.targetUID) is a jpg image object.
After that, reference_catalog.deleteReference is called with a None source_obj, and from there things go downhill.

I don't know why brain.sourceUID does not resolve to a valid object, and I don't know what should be done about it, but it seems that somewhere along the line there should be a safeguard against this case.

Also, if anyone has any suggestions on how to get around this so I can finish my upgrade, I would be much obliged.

@fulv
Copy link
Member Author

fulv commented Dec 8, 2015

Ok, I got around it by clearing the reference_catalog in Plone 4 before doing the upgrade.

@gforcada
Copy link
Sponsor Member

gforcada commented Dec 8, 2015

@fulv something to be added on the upgrade documentation?

@Martronic-SA
Copy link

I think clearing catalog is a workaround but not the solutions as ther are certainly references to keep.
You should just avoid migrating the ones that points to None with a try except / continue and migrating the good ones.

@pbauer pbauer closed this as completed in d6cbc67 Jul 17, 2017
pbauer added a commit that referenced this issue Jul 17, 2017
Do not fail on invalid objects in referenec_catalog. Fixes #32 and #48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants