Add automated_clean field
This field will define if the automated clean will be enabled on the node. The default will be true, so when automated cleanup is enabled generally, all the nodes will be cleaned. If some node needs to be skipped, automated_cleanup needs to be change to False. Change-Id: I47f4c4097f849472be54d2be81e1440b8f349edb Story: #2002161 Task: #20011
This commit is contained in:
parent
c542b1b69e
commit
94f0cedc98
@ -0,0 +1,31 @@
|
||||
# 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 automated_clean field
|
||||
|
||||
Revision ID: d2b036ae9378
|
||||
Revises: 664f85c2f622
|
||||
Create Date: 2018-07-25 15:30:20.860792
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd2b036ae9378'
|
||||
down_revision = '664f85c2f622'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('nodes', sa.Column('automated_clean', sa.Boolean(),
|
||||
nullable=True))
|
@ -175,6 +175,7 @@ class Node(Base):
|
||||
inspection_finished_at = Column(DateTime, nullable=True)
|
||||
inspection_started_at = Column(DateTime, nullable=True)
|
||||
extra = Column(db_types.JsonEncodedDict)
|
||||
automated_clean = Column(Boolean, nullable=True)
|
||||
|
||||
bios_interface = Column(String(255), nullable=True)
|
||||
boot_interface = Column(String(255), nullable=True)
|
||||
|
@ -760,6 +760,11 @@ class MigrationCheckersMixin(object):
|
||||
conductors_tbl.c.id == data['conductor_id']).execute().first()
|
||||
self.assertEqual(conductor['conductor_group'], "")
|
||||
|
||||
def _check_d2b036ae9378(self, engine, data):
|
||||
nodes = db_utils.get_table(engine, 'nodes')
|
||||
col_names = [column.name for column in nodes.c]
|
||||
self.assertIn('automated_clean', col_names)
|
||||
|
||||
def test_upgrade_and_version(self):
|
||||
with patch_with_engine(self.engine):
|
||||
self.migration_api.upgrade('head')
|
||||
|
Loading…
x
Reference in New Issue
Block a user