Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
slapos
Commits
3f3ee9f2
Commit
3f3ee9f2
authored
Oct 02, 2017
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recipe:softwaretype: treat options in a case sensitive way
parent
a1a221b5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
slapos/recipe/softwaretype.py
slapos/recipe/softwaretype.py
+5
-0
slapos/test/recipe/test_softwaretype.py
slapos/test/recipe/test_softwaretype.py
+30
-0
No files found.
slapos/recipe/softwaretype.py
View file @
3f3ee9f2
...
@@ -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."""
...
...
slapos/test/recipe/test_softwaretype.py
View file @
3f3ee9f2
...
@@ -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
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment