diff options
author | Doug Hellmann <doug@doughellmann.com> | 2014-11-21 14:45:13 -0500 |
---|---|---|
committer | Doug Hellmann <doug@doughellmann.com> | 2014-12-15 14:20:28 -0500 |
commit | 6feb19b0704d753d54fae6e46680a086a149b13c (patch) | |
tree | 7a3aa2a7f255279897ffb587a670638689a88886 | |
parent | 70c5b67df353f70f0253dd7b8bcc66c871f842ff (diff) | |
download | oslo-config-6feb19b0704d753d54fae6e46680a086a149b13c.tar.gz |
Stop sorting options on output
The option definitions within a group should not be sorted, since the
application or library developer may want to present them in a
particular logical order to make them easier to understand
Change-Id: I35bf14ad469fd98486cb02ce66c5bfde5e4f1b11
Closes-Bug: #1356591
-rw-r--r-- | oslo_config/generator.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/oslo_config/generator.py b/oslo_config/generator.py index 93594e0..612a7ca 100644 --- a/oslo_config/generator.py +++ b/oslo_config/generator.py @@ -279,16 +279,14 @@ def generate(conf): if not opts: continue namespaces = groups.setdefault(group or 'DEFAULT', []) - namespaces.append((namespace, - dict((opt.dest, opt) for opt in opts))) + namespaces.append((namespace, opts)) def _output_opts(f, group, namespaces): f.write('[%s]\n' % group) - for (namespace, opts_by_dest) in sorted(namespaces, - key=operator.itemgetter(0)): + for (namespace, opts) in sorted(namespaces, + key=operator.itemgetter(0)): f.write('\n#\n# From %s\n#\n' % namespace) - for opt in sorted(opts_by_dest.values(), - key=operator.attrgetter('dest')): + for opt in opts: f.write('\n') f.format(opt) |