cycle detection in object dependencies broken? #80
Labels
No Label
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: ungleich-public/cdist#80
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
closed
Fixed in https://code.ungleich.ch/ungleich-public/cdist/merge_requests/815.
mentioned in merge request !815
@steven Yes, that is in the idea I am talking about.
I will experiment with it.
CDIST_ORDER_DEPENDENCY should only be valid within the manifest where it is used.
That we have a global file tracking this is at least one of the problems.
What if we have a 'type_creation_order' (or whatever the file is called) per object, and also store it inside the object?
Guess that's similar to what @poljakowski talks about.
yes, but it is necessary evil. i, for one, support this evil env var.
@steven @nico What if we try to change how
CDIST_ORDER_DEPENDENCY
works?How about defining context in which this env var is valid, and a local list of type creation order start from beginning in each context?
E.g. we have init manifest:
type a:
type b:
type c:
First context is init manifest, so we have empty creation order, and then
a, b, c
.Then, type
a
is second context, with empty creation order in the beginning, and thena1, a2, a3
.The same for types
b
andc
.In the end we have this dependency tree:
For this context, cdist would need additional state variable(s).
In the beginning order dep is switched off.
When env var is detected and state is off we turn it on.
When env var is not in env any more and state is on then we turn it off.
When type manifest finishes (if we can detect this) we turn it off.
With the above dependencies, a1, b1 and c1 could be executed first, in arbitrary order.
@steven @nico Is this behavior compatible with the cdist order dep intention?
Or should every type defined by
c
be processed before any type defined inb
andc
?Just a thought, without any experiment, yet.
@ander CDIST_ORDER_DEPENDENCY instructs cdist to record last created type as a requirement for current processed type, from type creation order list.
For the first example above, this is what happens:
First init manifest is executed.
__foo created
type_creation_order = __foo
__foo finished
__bar created
type creation order = __foo, __bar
inject require __foo for __bar
__bar finished
After init manifest, type's manifests are processed.
__file/tmp/foo created
type creation order = __foo, __bar, __file/tmp/foo
inject __bar for __file/tmp/foo
autorequire __file/tmp/foo for __foo (type autorequires all types it uses)
but now you get cycle:
__foo -> __file/tmp/foo -> __bar -> __foo
CDIST_ORDER_DEPENDENCY
is evil, it breaks things.https://www.cdi.st/manual/latest/cdist-best-practice.html#perils-of-cdist-order-dependency
assigned to @poljakowski
if first type in initial manifest doesn't have CDIST_ORDER_DEPENDENCY, then it works:
changed the description