Browse Source

Zun: fix an issue on command property

The command property passed to zunclient should be list
instead of string.

Change-Id: Ic667407ccc380c29de412bb3b609f5a6cc070d5f
Story: #2005469
Task: #30548
changes/69/653269/2
Hongbin Lu 3 years ago
parent
commit
fd152785a6
  1. 4
      heat/engine/resources/openstack/zun/container.py
  2. 2
      heat/tests/openstack/zun/test_container.py

4
heat/engine/resources/openstack/zun/container.py

@ -12,6 +12,7 @@
# under the License.
import copy
import shlex
from heat.common import exception
from heat.common.i18n import _
@ -316,6 +317,9 @@ class Container(resource.Resource,
networks = args.pop(self.NETWORKS, None)
if networks:
args['nets'] = self._build_nets(networks)
command = args.pop(self.COMMAND, None)
if command:
args['command'] = shlex.split(command)
container = self.client().containers.run(**args)
self.resource_id_set(container.uuid)
return container.uuid

2
heat/tests/openstack/zun/test_container.py

@ -274,7 +274,7 @@ class ZunContainerTest(common.HeatTestCase):
self.client.containers.run.assert_called_once_with(
name=self.fake_name,
image=self.fake_image,
command=self.fake_command,
command=self.fake_command.split(),
cpu=self.fake_cpu,
memory=self.fake_memory,
environment=self.fake_env,

Loading…
Cancel
Save