Ansible: fix lowercasing issue with ConfigParser 13/46613/5
authorRoss Brattain <ross.b.brattain@intel.com>
Fri, 3 Nov 2017 03:21:39 +0000 (20:21 -0700)
committerRoss Brattain <ross.b.brattain@intel.com>
Fri, 3 Nov 2017 04:20:48 +0000 (21:20 -0700)
commit3e93bb8ff3ef9ff454d6be13295198dbeac75df7
tree911d0b54b8ea0f0aa17ca42c767945e5a0bb29a9
parent5a756e6171ad2d867914793dc2fd8b1aa7a19a6e
Ansible: fix lowercasing issue with ConfigParser

by default ConfigParser will lowercase everything,
unless you override optionxform.

also sort key value in inventory line for consistency

https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.optionxform

Transforms the option name option as found in an input file or as passed in by
client code to the form that should be used in the internal structures. The
default implementation returns a lower-case version of option; subclasses may
override this or client code can set an attribute of this name on instances to
affect this behavior.

You don’t need to subclass the parser to use this method, you can also set it
on an instance, to a function that takes a string argument and returns a
string. Setting it to str, for example, would make option names case sensitive:

cfgparser = ConfigParser()
cfgparser.optionxform = str

Note that when reading configuration files, whitespace around the option names
is stripped before optionxform() is called.

YARDSTICK-833

Change-Id: Ia1810b0c77922d84e11c9e538540b38816338593
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
tests/unit/common/test_ansible_common.py
yardstick/common/ansible_common.py