zopefoundation / Products.GenericSetup

Mini-framework for expressing the configured state of a Zope Site as a set of filesystem artifacts
Other
3 stars 12 forks source link

Non-existing dependency-profiles cause multiple errors #68

Open ida opened 6 years ago

ida commented 6 years ago

Refs: #64, https://github.com/plone/Products.CMFPlone/issues/2228.

The multiple errors still occur, I think the culprit lies in getProfileDependenciesChain, because it is calling itself recursively: https://github.com/zopefoundation/Products.GenericSetup/blob/3ca5ee7b3947e02e2cad0c3eaad17d4913322dd7/Products/GenericSetup/tool.py#L1331

And the try/except-block in _runImportStepsFromContext of where it's called initially, is masking this: https://github.com/zopefoundation/Products.GenericSetup/blob/3ca5ee7b3947e02e2cad0c3eaad17d4913322dd7/Products/GenericSetup/tool.py#L1386

Probably because the first try succeeds and later an exception occurs from a recursive-call.

So, I tried raising an error explicitly in getProfileDependenciesChain, but that also doesn't stop the execution of further code.

The only solution I came up with, is to return None in getDependenciesForProfile for symbolizing dependencies are broken, like it was sugested in #64: https://github.com/zopefoundation/Products.GenericSetup/pull/64/commits/dd1137493031167e296e95d4243c804fddb58724

That will cause the interpreter to raise a "not-iterable"-error in getProfileDependenciesChain and fail hard, as wished.

@tseaver, @icemac, @sunew, if you think this is feasible, I'd like to provide another PR.

ida commented 6 years ago

Closing this because I don't have more time left to spend on this. Thanks anyways!

ida commented 6 years ago

Made a sketch for failing when rising the instance, if a profile-name has no registration in a zcml-file: https://github.com/ida/Products.GenericSetup/commit/ca553414a9a9a6214c1328833ea70d6ea677b3d3

@tseaver As you are Zope-pioneer, I'd appreciate a lot your opinion, whether hooking into Products.GenericSetup.zcml.registerProfile, is rather a bad idea, or could be a way to go.

@sunew pinging you in case you're still on debugging the related issue in the Plone-repo.

sunew commented 6 years ago

@ida thanks - I had to take look at some other issues, but will return to this one during the week.