Merge "Deploy steps - DB model"

This commit is contained in:
Zuul 2018-07-14 04:19:33 +00:00 committed by Gerrit Code Review
commit 936f4c206c
5 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,33 @@
# All Rights Reserved.
#
# 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 deploy_step to node
Revision ID: b9117ac17882
Revises: fb3f10dd262e
Create Date: 2018-06-19 22:31:45.668156
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b9117ac17882'
down_revision = 'fb3f10dd262e'
def upgrade():
op.add_column('nodes', sa.Column('deploy_step', sa.Text(),
nullable=True))

View File

@ -144,6 +144,7 @@ class Node(Base):
driver_info = Column(db_types.JsonEncodedDict)
driver_internal_info = Column(db_types.JsonEncodedDict)
clean_step = Column(db_types.JsonEncodedDict)
deploy_step = Column(db_types.JsonEncodedDict)
resource_class = Column(String(80), nullable=True)
raid_config = Column(db_types.JsonEncodedDict)

View File

@ -100,6 +100,9 @@ def node_post_data(**kw):
node.pop('chassis_id')
node.pop('tags')
node.pop('traits')
# TODO(mgoddard): Remove this once the deploy_step field is supported in
# the API.
node.pop('deploy_step')
# NOTE(jroll): pop out fields that were introduced in later API versions,
# unless explicitly requested. Otherwise, these will cause tests using

View File

@ -719,6 +719,13 @@ class MigrationCheckersMixin(object):
self.assertIsInstance(nodes_tbl.c.fault.type,
sqlalchemy.types.String)
def _check_b9117ac17882(self, engine, data):
nodes = db_utils.get_table(engine, 'nodes')
col_names = [column.name for column in nodes.c]
self.assertIn('deploy_step', col_names)
self.assertIsInstance(nodes.c.deploy_step.type,
sqlalchemy.types.String)
def test_upgrade_and_version(self):
with patch_with_engine(self.engine):
self.migration_api.upgrade('head')

View File

@ -196,6 +196,7 @@ def get_test_node(**kw):
'driver_internal_info': kw.get('driver_internal_info',
fake_internal_info),
'clean_step': kw.get('clean_step'),
'deploy_step': kw.get('deploy_step'),
'properties': kw.get('properties', properties),
'reservation': kw.get('reservation'),
'maintenance': kw.get('maintenance', False),