Open cheribral opened 3 years ago
I think I found a solution with this problem, still present in 3007.1.
I tried to simplify the code by using salt.utils.odict.OrderedDict
like done in many other places to keep ordering of object.
With the example of this issue, the result order is [C, B, A, M, L, MINION_DICT]
.
I added some logs to make sure of the original order:
As you can see, my code avoid many loops and recursion by avoiding to pass all accumulated classes to classes_to_expand
, just the new ones found in the current class.
I'll propose a PR soon.
Regards.
Description When using saltclass with multiple levels of classes, all of which define states, the resulting state list only comes back with states for the top level classes. Looking at the code, it appears that it is ignoring the state lists returned from the recursive calls of
expand_classes_in_order
Setup
Expected behavior Running state.show_top with the above classes, one would expect a state list of
[1,2,3,4,5,6,7,8]
, but what comes back instead is[1,2,7]
Versions Report
salt --versions-report
``` Salt Version: Salt: 3002.1 Dependency Versions: cffi: 1.14.2 cherrypy: Not Installed dateutil: 2.8.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.11.1 libgit2: 0.28.2 M2Crypto: 0.35.2 Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.6.2 mysql-python: Not Installed pycparser: 2.20 pycrypto: 2.6.1 pycryptodome: 3.9.7 pygit2: 0.28.2 Python: 3.6.8 (default, Oct 13 2020, 16:18:22) python-gnupg: Not Installed PyYAML: 3.13 PyZMQ: 17.0.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.1.4 System Versions: dist: centos 7 Core locale: UTF-8 machine: x86_64 release: 3.10.0-1160.2.2.el7.x86_64 system: Linux version: CentOS Linux 7 Core ```Additional context Without knowing exactly what was intended, this is my rough guess as to what might have been meant to happen: