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
Labels
Merge Requests
105
Merge Requests
105
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
3c01d90e
Commit
3c01d90e
authored
Dec 20, 2018
by
Łukasz Nowak
Committed by
Łukasz Nowak
Dec 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos: Encode unicode to UTF-8
/reviewed-on
nexedi/slapos!480
parent
faa89605
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
3 deletions
+10
-3
slapos/recipe/request.py
slapos/recipe/request.py
+5
-2
slapos/recipe/slapconfiguration.py
slapos/recipe/slapconfiguration.py
+2
-0
slapos/test/recipe/test_request.py
slapos/test/recipe/test_request.py
+1
-0
slapos/test/recipe/test_slaposconfiguration.py
slapos/test/recipe/test_slaposconfiguration.py
+2
-1
No files found.
slapos/recipe/request.py
View file @
3c01d90e
...
...
@@ -190,12 +190,15 @@ class Recipe(object):
# Then try to get all the parameters. In case of problem, put empty string.
for
param
in
return_parameters
:
options
[
'connection-%s'
%
param
]
=
''
value
=
''
try
:
options
[
'connection-%s'
%
param
]
=
return_parameter_dict
[
param
]
value
=
return_parameter_dict
[
param
]
except
KeyError
:
if
self
.
failed
is
None
:
self
.
failed
=
param
if
isinstance
(
value
,
unicode
):
value
=
value
.
encode
(
'UTF-8'
)
options
[
'connection-%s'
%
param
]
=
value
def
_filterForStorage
(
self
,
partition_parameter_kw
):
return
partition_parameter_kw
...
...
slapos/recipe/slapconfiguration.py
View file @
3c01d90e
...
...
@@ -264,6 +264,8 @@ class Recipe(object):
# be very careful with overriding master's information
for
key
,
value
in
flatten_dict
(
partition_params
).
items
():
if
key
not
in
options
:
if
isinstance
(
value
,
unicode
):
value
=
value
.
encode
(
'UTF-8'
)
options
[
key
]
=
value
# print out augmented options to see what we are passing
logger
.
debug
(
str
(
options
))
...
...
slapos/test/recipe/test_request.py
View file @
3c01d90e
...
...
@@ -83,6 +83,7 @@ class RecipeTestMixin(object):
result
=
recipe
.
install
()
self
.
assertEqual
([],
result
)
self
.
assertEqual
(
options
[
'connection-anything'
],
'done'
)
self
.
assertIsInstance
(
options
[
'connection-anything'
],
str
)
self
.
request_instance
.
assert_called_with
(
''
,
'RootSoftwareInstance'
,
''
,
filter_kw
=
{},
partition_parameter_kw
=
self
.
called_partition_parameter_kw
,
...
...
slapos/test/recipe/test_slaposconfiguration.py
View file @
3c01d90e
...
...
@@ -18,7 +18,7 @@ class SlapConfigurationTest(unittest.TestCase):
self
.
resource_file
=
os
.
path
.
join
(
self
.
instance_root
,
slapformat
.
Partition
.
resource_file
)
self
.
resource
=
{
"tun"
:
{
"ipv4"
:
"192.168.0.1"
"ipv4"
:
u
"192.168.0.1"
},
"address_list"
:
[
10
,
20
...
...
@@ -48,6 +48,7 @@ class SlapConfigurationTest(unittest.TestCase):
self
.
assertEqual
(
options
[
'tun-ipv4'
],
"192.168.0.1"
,
"Folded attrs should be separated by -"
)
self
.
assertIsInstance
(
options
[
'tun-ipv4'
],
str
)
self
.
assertEqual
(
options
[
'address-list'
],
[
10
,
20
],
"All underscores should be replaced with -"
)
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