Circular dependencies with export CDIST_ORDER_DEPENDENCY=1 #99
Labels
No labels
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ungleich-public/cdist#99
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: darko-poljak
In mailing list the following case was reported as not working, resulting in circular dependency.
Init manifest
__foo type manifest:
Error
__user/... requires:
__group/...
is the result of injecting last created type requirement
__group/... requires:
__foo/...
is the result of injecting last created type requirement
__foo/... autorequires:
__user/...
is the result of autorequirement.
foo autorequires group is not set since group requires foo was injected.
Created by: darko-poljak
@telmich I will try to clarify the case better.
Let we have the following init manifest:
and foo type manifest:
So this means that we want dependency in type's manifest based on the order of types.
Here we want that
__usertype requires__grouptype.What cdist determines is that
So,
__userrequires__group, which requires__foo, which requires__user, and we have circle here.How we came to that dependency tree?
__footype should depend on all types it uses in its manifest.When
__footype is executed, first__grouptype is executed.CDIST_ORDER_DEPENDENCYis defined.It looks for the previous type created. It finds
__footype and injects it as a requirement.And now we have
__group/... requires: __foo/....__fooauto requires__gorup,but it sees that
__groupalready requires__fooso it skips this.__usertype is executed.CDIST_ORDER_DEPENDENCYis defined.It looks for the previous type created. It finds
__grouptype and injects it as a requirement.And now we have
__user/... requires: __group/....__fooauto requires__user,it sees that there is no
__userrequires__fooso it defines:__foo/... autorequires:__user/....In the end we have this:
And this is wrong!
The wrong step is in 2.. cdist should not inject requirement of type which manifest is being executed for a type in type's manifest. In the above case, requirement of
__foofor type__groupshould not be injected!Note that when
CDIST_ORDER_DEPENDENCYin used only in init manifest, this does not happen because for init manifest, when first type is executed, previous type created is None.Created by: darko-poljak
@telmich @asteven
The wrong part here is
__group/... requires:
__foo/...
injection.
When CDIST_ORDER_REQUIREMENT is set, if last created type is object whose type manifest is
currently being executed, then such requirement should not be injected.
PR follows.