Commit 3f3ee9f2 authored by Jérome Perrin's avatar Jérome Perrin

recipe:softwaretype: treat options in a case sensitive way

parent a1a221b5
...@@ -54,6 +54,11 @@ class SlapConfigParser(ConfigParser, object): ...@@ -54,6 +54,11 @@ class SlapConfigParser(ConfigParser, object):
This is invalid with buildout version 2. This is invalid with buildout version 2.
""" """
def optionxform(self, option):
"""Treat options in a case sensitive way.
This is what buildout does, but not the default ConfigParser.
"""
return option
def write(self, fp): def write(self, fp):
"""Write an .ini-format representation of the configuration state.""" """Write an .ini-format representation of the configuration state."""
......
...@@ -100,3 +100,33 @@ command = touch file_created_when_running_instance ...@@ -100,3 +100,33 @@ command = touch file_created_when_running_instance
]) ])
@mock.patch('slapos.slap.slap.registerComputerPartition')
def test_case_sensitive_options(self, mock_client):
mock_client.return_value = self._mockComputerPartition()
buildout_directory = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, buildout_directory)
instance_buildout_file = os.path.join(buildout_directory, 'instance-test.cfg')
with open(instance_buildout_file, 'w') as software_type_buildout:
software_type_buildout.write('''
[buildout]
parts = test
[other-section]
OpTiOn = file_created_when_running_instance
[test]
recipe = plone.recipe.command
command = touch ${other-section:OpTiOn}
''')
self.recipe.buildout['buildout']['directory'] = buildout_directory
self.recipe.options['test'] = instance_buildout_file
sys.argv = ['buildout', ]
self.recipe.install()
self.assertIn(
'file_created_when_running_instance',
os.listdir(buildout_directory))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment