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.
in: body
required: true
type: string
type: array
entrypoint-request:
description: |
The entrypoint which overwrites the default ENTRYPOINT of the image.
in: body
required: false
type: string
type: array
environment:
description: |
The environment variables to set in the container.

View File

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

View File

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

View File

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

View File

@ -107,7 +107,7 @@ class ContainerBase(base.ZunPersistentObject, base.ZunObject):
'registry': fields.ObjectField("Registry", nullable=True),
'annotations': 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

View File

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

View File

@ -103,7 +103,7 @@ def get_test_container(**kwargs):
'capsule_id': kwargs.get('capsule_id', 33),
'annotations': kwargs.get('annotations', '{"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
# https://docs.openstack.org/zun/latest/
object_data = {
'Capsule': '1.4-85456b38adcac18d823e86e19c71bdf0',
'CapsuleContainer': '1.4-0ca5d5683474b1288a9e3bcea7e4f1d3',
'CapsuleInitContainer': '1.4-0ca5d5683474b1288a9e3bcea7e4f1d3',
'Container': '1.44-9734f84e52fc04abd0a7e206f398e15b',
'Capsule': '1.4-66820eeca01c71b41db2270e7321ffe4',
'CapsuleContainer': '1.4-740c49be2097362c640f39765cf2706e',
'CapsuleInitContainer': '1.4-740c49be2097362c640f39765cf2706e',
'Container': '1.44-63357c7ce1fa6b6fdb462296b8d556cf',
'Cpuset': '1.0-06c4e6335683c18b87e2e54080f8c341',
'Volume': '1.0-034768f2f5c5e89acb5ee45c6d3f3403',
'VolumeMapping': '1.5-57febc66526185a75a744637e7a387c7',