I'm converting from haproxy.cfg files generated by one system to ones that are generated by a very different system. As part of the process, I want to compare the old and new haproxy.cfg files to make sure they are equivalent. "diff" isn't useful because the sections are in different orders, and the subcommands within the sections are not ordered the same.
I'd like to normalize the old and new files so that "diff" comparisons are easier. I am writing a program to do so. (I'll open source it when it is done). The first step is to put the sections in a fixed order: First general, the defaults, then each listen/frontend/backend sorted by name. That works fine and has been a big help. The next step is to sort the subcommands within a section. This will make the subsections easier to compare. However I can not simply sort them lexicographically, however ACLs and other subcommands are depend on the order they are declared. My hunch is that if I keep the following subcommands in the order they appear in the original file, all the other subcommands can be sorted alphabetically and put at the top of that section: acl capture http-request redirect req* rsp* tcp-request use-server use_backend Is this hunch correct? Are there other subcommands that are order dependent? Thanks! Tom