Fix: all containers are being set privileged

This patch simplies the check for privileged so that we treat
it as a pass through string. Previously we were converting
to a string before doing the boolean check which was causing
all containers to get set to --privileged true.

Change-Id: Ibe2221abf9616c1c54acecf7c18ae36e2c07576c
This commit is contained in:
Dan Prince 2017-01-16 08:40:56 -05:00
parent 1e87454039
commit ccbfef9cb4
2 changed files with 5 additions and 2 deletions

View File

@ -42,7 +42,7 @@ def docker_arg_map(key, value):
'image': value,
'net': "--net=%s" % value,
'pid': "--pid=%s" % value,
'privileged': "--privileged=%s" % 'true' if value else 'false',
'privileged': "--privileged=%s" % value.lower(),
'restart': "--restart=%s" % value,
'user': "--user=%s" % value,
'volumes': "--volume=%s" % value,

View File

@ -29,7 +29,8 @@ class HookDockerCmdTest(common.RunScriptTest):
"config": {
"web": {
"name": "x",
"image": "xxx"
"image": "xxx",
"privileged": False
},
"web-ls": {
"action": "exec",
@ -129,6 +130,7 @@ class HookDockerCmdTest(common.RunScriptTest):
'--name',
'web',
'--detach=true',
'--privileged=false',
'xxx'
], state_1['args'])
self.assertEqual([
@ -183,6 +185,7 @@ class HookDockerCmdTest(common.RunScriptTest):
'--name',
'web',
'--detach=true',
'--privileged=false',
'xxx'
], state_1['args'])