summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLars Kellogg-Stedman <lars@redhat.com>2014-09-01 11:29:11 -0400
committerLars Kellogg-Stedman <lars@redhat.com>2014-09-01 11:34:52 -0400
commit03638b3e739d19831910a5be8d231e30cadfb545 (patch)
tree19cb0368c389875231956c2b53e50d4238d7372e /contrib
parent540249824f4132f67925fe8e7b4bc7c13feb6c64 (diff)
downloadheat-03638b3e739d19831910a5be8d231e30cadfb545.tar.gz
correctly implement volumes_from property
The Docker plugin incorrectly implements the 'volumes_from' option: - The property is marked as a string when it should be a list, and - The property needs to be passed to start_container rather than create_container. Change-Id: I617a4d29a9edbb45d80c7b8abb8f87eeaf795a8b closes-bug: #1364041 closes-bug: #1364039
Diffstat (limited to 'contrib')
-rw-r--r--contrib/heat_docker/heat_docker/resources/docker_container.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/contrib/heat_docker/heat_docker/resources/docker_container.py b/contrib/heat_docker/heat_docker/resources/docker_container.py
index 2c9216414..7661b2a99 100644
--- a/contrib/heat_docker/heat_docker/resources/docker_container.py
+++ b/contrib/heat_docker/heat_docker/resources/docker_container.py
@@ -138,7 +138,7 @@ class DockerContainer(resource.Resource):
default={}
),
VOLUMES_FROM: properties.Schema(
- properties.Schema.STRING,
+ properties.Schema.LIST,
_('Mount all specified volumes.'),
default=''
),
@@ -246,7 +246,7 @@ class DockerContainer(resource.Resource):
return logs.split('\n').pop()
def handle_create(self):
- args = {
+ create_args = {
'image': self.properties[self.IMAGE],
'command': self.properties[self.CMD],
'hostname': self.properties[self.HOSTNAME],
@@ -258,26 +258,28 @@ class DockerContainer(resource.Resource):
'environment': self.properties[self.ENV],
'dns': self.properties[self.DNS],
'volumes': self.properties[self.VOLUMES],
- 'volumes_from': self.properties[self.VOLUMES_FROM],
'name': self.properties[self.NAME]
}
client = self.get_client()
client.pull(self.properties[self.IMAGE])
- result = client.create_container(**args)
+ result = client.create_container(**create_args)
container_id = result['Id']
self.resource_id_set(container_id)
- kwargs = {}
+ start_args = {}
+
if self.properties[self.PRIVILEGED]:
- kwargs[self.PRIVILEGED] = True
+ start_args[self.PRIVILEGED] = True
if self.properties[self.VOLUMES]:
- kwargs['binds'] = self.properties[self.VOLUMES]
+ start_args['binds'] = self.properties[self.VOLUMES]
+ if self.properties[self.VOLUMES_FROM]:
+ start_args['volumes_from'] = self.properties[self.VOLUMES_FROM]
if self.properties[self.PORT_BINDINGS]:
- kwargs['port_bindings'] = self.properties[self.PORT_BINDINGS]
+ start_args['port_bindings'] = self.properties[self.PORT_BINDINGS]
if self.properties[self.LINKS]:
- kwargs['links'] = self.properties[self.LINKS]
+ start_args['links'] = self.properties[self.LINKS]
- client.start(container_id, **kwargs)
+ client.start(container_id, **start_args)
return container_id
def _get_container_status(self, container_id):