You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While new version is still semantically equivalent to the old version, it is confusing to reviewers. We should attempt to reduce that confusion by preserving the order of the elements e.g. is there some way to make Ansible/Jinja use an OrderedDict when parsing/writing out the elements? If there isn't, then maybe there is some way to sort the keys - the first time we do this we may see a large change, but subsequent changes should be much smaller.
It's a mystery to me why Ansible reorders keys. But even though Ansible reorders the keys, it does this consistently. i.e. in https://github.com/linux-system-roles/network/pull/607/files#diff-20d1610925e550787a5f9dd9061f1e8ce9cee711b8f8165cd066b151179a9ba9R5 test_playbook: tests_default.yml was added to a file manually earlier, then our automation reordered the lines, but the next time you run the automation the lines won't be reordered. So, going forward the file won't change. Only some manual edits to the file can be overwritten.
We can sort the keys with sort to ensure that they are in alphabetical order, but this would create much noice indeed.
It's a mystery to me why Ansible reorders keys. But even though Ansible reorders the keys, it does this consistently. i.e. in https://github.com/linux-system-roles/network/pull/607/files#diff-20d1610925e550787a5f9dd9061f1e8ce9cee711b8f8165cd066b151179a9ba9R5 test_playbook: tests_default.yml was added to a file manually earlier, then our automation reordered the lines, but the next time you run the automation the lines won't be reordered. So, going forward the file won't change. Only some manual edits to the file can be overwritten.
ok - then maybe this isn't really a problem?
We can sort the keys with sort to ensure that they are in alphabetical order, but this would create much noise indeed.
Yes, but maybe we shouldn't do anything just yet until we can confirm that this is an ongoing problem. See also ansible/ansible#17763 - maybe there is a way to denote that a dict should be parsed/formatted with an OrderedDict
For example, https://github.com/linux-system-roles/.github/blob/main/inventory/host_vars/network.yml#L9
when this was applied to the role, the order of the keys was not preserved, leading to a spurious change: https://github.com/linux-system-roles/network/pull/603/files#diff-20d1610925e550787a5f9dd9061f1e8ce9cee711b8f8165cd066b151179a9ba9L4
While new version is still semantically equivalent to the old version, it is confusing to reviewers. We should attempt to reduce that confusion by preserving the order of the elements e.g. is there some way to make Ansible/Jinja use an
OrderedDict
when parsing/writing out the elements? If there isn't, then maybe there is some way tosort
the keys - the first time we do this we may see a large change, but subsequent changes should be much smaller.@spetrosi
The text was updated successfully, but these errors were encountered: