Add registry_enabled to api and db

Add registry_enabled to baymodel to indicate whether the
docker registry is enabled.

Change-Id: I3276c2dda9ae8454b5bedc1245969c709b72c142
Partially-Implements: blueprint registryv2-in-master
This commit is contained in:
Hua Wang 2015-09-14 18:47:38 +08:00
parent d470d46bb0
commit c1058654e6
6 changed files with 40 additions and 2 deletions

View File

@ -112,6 +112,9 @@ class BayModel(base.APIBase):
"""Its comma separated list of ip for which proxies should not
used in the bay"""
registry_enabled = wsme.wsattr(types.boolean, default=False)
"""Indicates whether the docker registry is enabled"""
def __init__(self, **kwargs):
self.fields = []
for field in objects.BayModel.fields:

View File

@ -0,0 +1,30 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Add registry_enabled
Revision ID: 4e263f236334
Revises: 5518af8dbc21
Create Date: 2015-09-14 18:39:25.871218
"""
# revision identifiers, used by Alembic.
revision = '4e263f236334'
down_revision = '5518af8dbc21'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('baymodel', sa.Column('registry_enabled',
sa.Boolean(), default=False))

View File

@ -21,6 +21,7 @@ import json
from oslo_config import cfg
from oslo_db.sqlalchemy import models
import six.moves.urllib.parse as urlparse
from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Integer
@ -168,6 +169,7 @@ class BayModel(Base):
http_proxy = Column(String(255))
https_proxy = Column(String(255))
no_proxy = Column(String(255))
registry_enabled = Column(Boolean, default=False)
class Container(Base):

View File

@ -25,7 +25,8 @@ from magnum.objects import base
class BayModel(base.MagnumPersistentObject, base.MagnumObject,
base.MagnumObjectDictCompat):
# Version 1.0: Initial version
VERSION = '1.0'
# Version 1.1: Add 'registry_enabled' field
VERSION = '1.1'
dbapi = dbapi.get_instance()
@ -50,6 +51,7 @@ class BayModel(base.MagnumPersistentObject, base.MagnumObject,
'http_proxy': fields.StringField(nullable=True),
'https_proxy': fields.StringField(nullable=True),
'no_proxy': fields.StringField(nullable=True),
'registry_enabled': fields.BooleanField(default=False)
}
@staticmethod

View File

@ -50,6 +50,7 @@ def get_test_baymodel(**kw):
'http_proxy': kw.get('http_proxy', 'fake_http_proxy'),
'https_proxy': kw.get('https_proxy', 'fake_https_proxy'),
'no_proxy': kw.get('no_proxy', 'fake_no_proxy'),
'registry_enabled': kw.get('registry_enabled', False)
}

View File

@ -425,7 +425,7 @@ class _TestObject(object):
object_data = {
'Bay': '1.0-35edde13ad178e9419e7ea8b6d580bcd',
'BayLock': '1.0-7d1eb08cf2070523bd210369c7a2e076',
'BayModel': '1.0-06863f04ab4b98307e3d1b736d3137bf',
'BayModel': '1.1-0ada1b67f847f673ccbdb59a20eefae9',
'Certificate': '1.0-2aff667971b85c1edf8d15684fd7d5e2',
'Container': '1.0-e12affbba5f8a748882a3ae98aced282',
'MyObj': '1.0-b43567e512438205e32f4e95ca616697',