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…
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
__user
type requires__group
type.What cdist determines is that
So,
__user
requires__group
, which requires__foo
, which requires__user
, and we have circle here.How we came to that dependency tree?
__foo
type should depend on all types it uses in its manifest.When
__foo
type is executed, first__group
type is executed.CDIST_ORDER_DEPENDENCY
is defined.It looks for the previous type created. It finds
__foo
type and injects it as a requirement.And now we have
__group/... requires: __foo/...
.__foo
auto requires__gorup
,but it sees that
__group
already requires__foo
so it skips this.__user
type is executed.CDIST_ORDER_DEPENDENCY
is defined.It looks for the previous type created. It finds
__group
type and injects it as a requirement.And now we have
__user/... requires: __group/...
.__foo
auto requires__user
,it sees that there is no
__user
requires__foo
so 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
__foo
for type__group
should not be injected!Note that when
CDIST_ORDER_DEPENDENCY
in 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.