_order_steps() method of Workflow is broken
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Dashboard (Horizon) |
Fix Released
|
Low
|
Kent Wang |
Bug Description
The method is here:
https:/
The method sorts steps which were dynamically added to workflow with register(...). The steps are compared using their 'before' and 'after' fields. The proper way to compare such elements having "incomplete" order is topological sorting. The method instead employs an incorrect greedy algorithm. The method can fail if input list has size of 3 or more.
I see two ways to fix the issue:
1. (preferred) remove sorting and simply show tabs in the order they were registered. That makes code simpler - we get rid of 'after' and 'before' fields of Step and _order_steps() method of Workflow. On the other hand seems like nobody uses that feature, otherwise they would already bump into the issue.
2. Implement proper sorting.
I can provide a fix for that issue
Changed in horizon: | |
milestone: | havana-3 → none |
Changed in horizon: | |
assignee: | nobody → Kent Wang (k.wang) |
First I saw the contribute/depend on logic. I have expected some sort of intelligent sorting of steps, that depends on workflow's contribute/depends on fields, seems it's not there.
It will be good to raise a verbose exception, that will say that you need to reorder your code, if the order is bad. Like when one step that depends on previous step's data is placed badly.
So I guess 3. option is: let the steps be in the order they were registered, with verbose exception if it is ordered badly (depending on contribute/depends on logic)
What do you think?