Change entrypoint from string to list

The field 'entrypoint' is a list in docker, so we change its type
to list to match the docker data model.

Change-Id: I52d833206b8927be40a604a2efc56ff3bb4fc58d
This commit is contained in:
Hongbin Lu 2020-04-04 17:10:37 +00:00
parent 3fe89808c6
commit 3901e575c1
8 changed files with 16 additions and 14 deletions

View File

@ -834,13 +834,13 @@ entrypoint:
The entrypoint which overwrites the default ENTRYPOINT of the image. The entrypoint which overwrites the default ENTRYPOINT of the image.
in: body in: body
required: true required: true
type: string type: array
entrypoint-request: entrypoint-request:
description: | description: |
The entrypoint which overwrites the default ENTRYPOINT of the image. The entrypoint which overwrites the default ENTRYPOINT of the image.
in: body in: body
required: false required: false
type: string type: array
environment: environment:
description: | description: |
The environment variables to set in the container. The environment variables to set in the container.

View File

@ -86,7 +86,7 @@ command_list = {
} }
entrypoint = { entrypoint = {
'type': ['string', 'null'] 'type': ['array', 'null']
} }
auto_remove = { auto_remove = {

View File

@ -27,6 +27,8 @@ depends_on = None
from alembic import op from alembic import op
import sqlalchemy as sa import sqlalchemy as sa
import zun
def upgrade(): def upgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### commands auto generated by Alembic - please adjust! ###
@ -34,7 +36,7 @@ def upgrade():
batch_op.add_column( batch_op.add_column(
sa.Column( sa.Column(
'entrypoint', 'entrypoint',
sa.String(length=255), zun.db.sqlalchemy.models.JSONEncodedList(),
nullable=True)) nullable=True))
# ### end Alembic commands ### # ### end Alembic commands ###

View File

@ -184,7 +184,7 @@ class Container(Base):
server_default=str(consts.TYPE_CONTAINER)) server_default=str(consts.TYPE_CONTAINER))
annotations = Column(MediumText()) annotations = Column(MediumText())
cni_metadata = Column(MediumText()) cni_metadata = Column(MediumText())
entrypoint = Column(String(255)) entrypoint = Column(JSONEncodedList)
class VolumeMapping(Base): class VolumeMapping(Base):

View File

@ -107,7 +107,7 @@ class ContainerBase(base.ZunPersistentObject, base.ZunObject):
'registry': fields.ObjectField("Registry", nullable=True), 'registry': fields.ObjectField("Registry", nullable=True),
'annotations': z_fields.JsonField(nullable=True), 'annotations': z_fields.JsonField(nullable=True),
'cni_metadata': z_fields.JsonField(nullable=True), 'cni_metadata': z_fields.JsonField(nullable=True),
'entrypoint': fields.StringField(nullable=True), 'entrypoint': fields.ListOfStringsField(nullable=True),
} }
# should be redefined in subclasses # should be redefined in subclasses

View File

@ -150,7 +150,7 @@ class TestDockerDriver(base.DriverTestCase):
'name': '%sea8e2a25-2901-438d-8157-de7ffd68d051' % 'name': '%sea8e2a25-2901-438d-8157-de7ffd68d051' %
consts.NAME_PREFIX, consts.NAME_PREFIX,
'command': ['fake_command'], 'command': ['fake_command'],
'entrypoint': 'fake_entrypoint', 'entrypoint': ['fake_entrypoint'],
'environment': {'key1': 'val1', 'key2': 'val2'}, 'environment': {'key1': 'val1', 'key2': 'val2'},
'working_dir': '/home/ubuntu', 'working_dir': '/home/ubuntu',
'labels': {'key1': 'val1', 'key2': 'val2'}, 'labels': {'key1': 'val1', 'key2': 'val2'},
@ -224,7 +224,7 @@ class TestDockerDriver(base.DriverTestCase):
'name': '%sea8e2a25-2901-438d-8157-de7ffd68d051' % 'name': '%sea8e2a25-2901-438d-8157-de7ffd68d051' %
consts.NAME_PREFIX, consts.NAME_PREFIX,
'command': ['fake_command'], 'command': ['fake_command'],
'entrypoint': 'fake_entrypoint', 'entrypoint': ['fake_entrypoint'],
'environment': {'key1': 'val1', 'key2': 'val2'}, 'environment': {'key1': 'val1', 'key2': 'val2'},
'working_dir': '/home/ubuntu', 'working_dir': '/home/ubuntu',
'labels': {'key1': 'val1', 'key2': 'val2'}, 'labels': {'key1': 'val1', 'key2': 'val2'},
@ -296,7 +296,7 @@ class TestDockerDriver(base.DriverTestCase):
'name': '%sea8e2a25-2901-438d-8157-de7ffd68d051' % 'name': '%sea8e2a25-2901-438d-8157-de7ffd68d051' %
consts.NAME_PREFIX, consts.NAME_PREFIX,
'command': ['fake_command'], 'command': ['fake_command'],
'entrypoint': 'fake_entrypoint', 'entrypoint': ['fake_entrypoint'],
'environment': {'key1': 'val1', 'key2': 'val2'}, 'environment': {'key1': 'val1', 'key2': 'val2'},
'working_dir': '/home/ubuntu', 'working_dir': '/home/ubuntu',
'labels': {'key1': 'val1', 'key2': 'val2'}, 'labels': {'key1': 'val1', 'key2': 'val2'},

View File

@ -103,7 +103,7 @@ def get_test_container(**kwargs):
'capsule_id': kwargs.get('capsule_id', 33), 'capsule_id': kwargs.get('capsule_id', 33),
'annotations': kwargs.get('annotations', '{"key": "val"}'), 'annotations': kwargs.get('annotations', '{"key": "val"}'),
'cni_metadata': kwargs.get('cni_metadata', '{"key": "val"}'), 'cni_metadata': kwargs.get('cni_metadata', '{"key": "val"}'),
'entrypoint': kwargs.get('entrypoint', 'fake_entrypoint'), 'entrypoint': kwargs.get('entrypoint', ['fake_entrypoint']),
} }

View File

@ -344,10 +344,10 @@ class TestObject(test_base.TestCase, _TestObject):
# For more information on object version testing, read # For more information on object version testing, read
# https://docs.openstack.org/zun/latest/ # https://docs.openstack.org/zun/latest/
object_data = { object_data = {
'Capsule': '1.4-85456b38adcac18d823e86e19c71bdf0', 'Capsule': '1.4-66820eeca01c71b41db2270e7321ffe4',
'CapsuleContainer': '1.4-0ca5d5683474b1288a9e3bcea7e4f1d3', 'CapsuleContainer': '1.4-740c49be2097362c640f39765cf2706e',
'CapsuleInitContainer': '1.4-0ca5d5683474b1288a9e3bcea7e4f1d3', 'CapsuleInitContainer': '1.4-740c49be2097362c640f39765cf2706e',
'Container': '1.44-9734f84e52fc04abd0a7e206f398e15b', 'Container': '1.44-63357c7ce1fa6b6fdb462296b8d556cf',
'Cpuset': '1.0-06c4e6335683c18b87e2e54080f8c341', 'Cpuset': '1.0-06c4e6335683c18b87e2e54080f8c341',
'Volume': '1.0-034768f2f5c5e89acb5ee45c6d3f3403', 'Volume': '1.0-034768f2f5c5e89acb5ee45c6d3f3403',
'VolumeMapping': '1.5-57febc66526185a75a744637e7a387c7', 'VolumeMapping': '1.5-57febc66526185a75a744637e7a387c7',