Strings length constants is removed from DeploymentGraph models and migrations
Constants is removed to avoid difference in 9.0 migrations and models work if constants values will be changed in the next updates. Change-Id: Ibc8d846fef787e4d93364b22c4f626b01a6d7d71 Implements: blueprint custom-graph-execution
This commit is contained in:
parent
f58ac5fc7f
commit
a3bb7b2a0b
|
@ -492,13 +492,6 @@ IRONIC_BOOTSTRAP_PKGS = ('openssh-server',
|
|||
'xz-utils',
|
||||
'linux-headers-generic')
|
||||
|
||||
DEPLOYMENT_TASK_NAME_MAX_LEN = 255
|
||||
DEPLOYMENT_TASK_GROUP_NAME_MAX_LEN = 255
|
||||
NAILGUN_EVENT_NAME_MAX_LEN = 255
|
||||
DEPLOYMENT_GRAPH_TYPE_MAX_LEN = 255
|
||||
DEPLOYMENT_GRAPH_NAME_MAX_LEN = 255
|
||||
DEPLOYMENT_TASK_VERSION_MAX_LEN = 255
|
||||
NODE_ROLE_NAME_MAX_LEN = 255
|
||||
DEPLOYMENT_TASK_DEFAULT_VERSION = '1.0.0'
|
||||
DEFAULT_DEPLOYMENT_GRAPH_TYPE = 'default'
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ from sqlalchemy.dialects import postgresql as psql
|
|||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from nailgun import consts
|
||||
from nailgun.db.sqlalchemy.models import fields
|
||||
from nailgun.utils.migration import drop_enum
|
||||
from nailgun.utils.migration import upgrade_enum
|
||||
|
@ -635,7 +634,7 @@ def upgrade_node_roles_metadata():
|
|||
}
|
||||
for role_name, role_metadata in six.iteritems(roles_metadata):
|
||||
role_metadata['group'] = role_groups\
|
||||
.get(role_name, consts.NODE_ROLE_GROUPS.other)
|
||||
.get(role_name, 'other')
|
||||
|
||||
connection.execute(
|
||||
update_query,
|
||||
|
@ -846,7 +845,7 @@ def upgrade_deployment_graph():
|
|||
|
||||
sa.Column(
|
||||
'verbose_name',
|
||||
sa.VARCHAR(length=consts.DEPLOYMENT_GRAPH_NAME_MAX_LEN),
|
||||
sa.VARCHAR(length=255),
|
||||
nullable=True),
|
||||
)
|
||||
|
||||
|
@ -871,7 +870,7 @@ def upgrade_deployment_graph():
|
|||
|
||||
sa.Column(
|
||||
'task_name',
|
||||
sa.VARCHAR(length=consts.DEPLOYMENT_TASK_NAME_MAX_LEN),
|
||||
sa.VARCHAR(length=255),
|
||||
nullable=False),
|
||||
sa.UniqueConstraint(
|
||||
'deployment_graph_id',
|
||||
|
@ -880,10 +879,10 @@ def upgrade_deployment_graph():
|
|||
|
||||
sa.Column(
|
||||
'version',
|
||||
sa.VARCHAR(consts.DEPLOYMENT_TASK_VERSION_MAX_LEN),
|
||||
sa.VARCHAR(255),
|
||||
nullable=False,
|
||||
server_default=consts.DEPLOYMENT_TASK_DEFAULT_VERSION,
|
||||
default=consts.DEPLOYMENT_TASK_DEFAULT_VERSION),
|
||||
server_default='1.0.0',
|
||||
default='1.0.0'),
|
||||
|
||||
sa.Column(
|
||||
'condition',
|
||||
|
@ -905,56 +904,65 @@ def upgrade_deployment_graph():
|
|||
sa.Column(
|
||||
'type',
|
||||
sa.Enum(
|
||||
*consts.ORCHESTRATOR_TASK_TYPES,
|
||||
'puppet',
|
||||
'shell',
|
||||
'sync',
|
||||
'upload_file',
|
||||
'group',
|
||||
'stage',
|
||||
'skipped',
|
||||
'reboot',
|
||||
'copy_files',
|
||||
'role',
|
||||
name='deployment_graph_tasks_type'),
|
||||
nullable=False),
|
||||
|
||||
# legacy field, will be removed in next patches
|
||||
sa.Column(
|
||||
'groups',
|
||||
psql.ARRAY(sa.String(consts.DEPLOYMENT_TASK_GROUP_NAME_MAX_LEN)),
|
||||
psql.ARRAY(sa.String(255)),
|
||||
default=[],
|
||||
nullable=False,
|
||||
server_default='{}'),
|
||||
|
||||
sa.Column(
|
||||
'tasks',
|
||||
psql.ARRAY(sa.String(consts.DEPLOYMENT_TASK_NAME_MAX_LEN)),
|
||||
psql.ARRAY(sa.String(255)),
|
||||
default=[],
|
||||
nullable=False,
|
||||
server_default='{}'),
|
||||
|
||||
sa.Column(
|
||||
'roles',
|
||||
psql.ARRAY(sa.String(consts.NODE_ROLE_NAME_MAX_LEN)),
|
||||
psql.ARRAY(sa.String(255)),
|
||||
default=[],
|
||||
nullable=False,
|
||||
server_default='{}'),
|
||||
|
||||
sa.Column(
|
||||
'reexecute_on',
|
||||
psql.ARRAY(sa.String(consts.NAILGUN_EVENT_NAME_MAX_LEN)),
|
||||
psql.ARRAY(sa.String(255)),
|
||||
default=[],
|
||||
nullable=False,
|
||||
server_default='{}'),
|
||||
|
||||
sa.Column(
|
||||
'refresh_on',
|
||||
psql.ARRAY(sa.String(consts.NAILGUN_EVENT_NAME_MAX_LEN)),
|
||||
psql.ARRAY(sa.String(255)),
|
||||
default=[],
|
||||
nullable=False,
|
||||
server_default='{}'),
|
||||
|
||||
sa.Column(
|
||||
'required_for',
|
||||
psql.ARRAY(sa.String(consts.DEPLOYMENT_TASK_NAME_MAX_LEN)),
|
||||
psql.ARRAY(sa.String(255)),
|
||||
default=[],
|
||||
nullable=False,
|
||||
server_default='{}'),
|
||||
|
||||
sa.Column(
|
||||
'requires',
|
||||
psql.ARRAY(sa.String(consts.DEPLOYMENT_TASK_NAME_MAX_LEN)),
|
||||
psql.ARRAY(sa.String(255)),
|
||||
default=[],
|
||||
nullable=False,
|
||||
server_default='{}'),
|
||||
|
@ -997,7 +1005,7 @@ def upgrade_deployment_graph():
|
|||
|
||||
sa.Column(
|
||||
'type',
|
||||
sa.VARCHAR(length=consts.DEPLOYMENT_GRAPH_TYPE_MAX_LEN),
|
||||
sa.VARCHAR(length=255),
|
||||
nullable=False),
|
||||
|
||||
sa.Column(
|
||||
|
@ -1046,7 +1054,7 @@ def upgrade_deployment_graph():
|
|||
def create_graph_from_json_tasks(json_tasks):
|
||||
deployment_graph_id = connection.execute(
|
||||
deployment_graph_table.insert(),
|
||||
{'verbose_name': consts.DEFAULT_DEPLOYMENT_GRAPH_TYPE}
|
||||
{'verbose_name': 'default'}
|
||||
).inserted_primary_key[0]
|
||||
fields_mapping = {
|
||||
'id': 'task_name',
|
||||
|
@ -1103,7 +1111,7 @@ def upgrade_deployment_graph():
|
|||
insert_relation_query,
|
||||
deployment_graph_id=deployment_graph_id,
|
||||
target_id=entity_id,
|
||||
type=consts.DEFAULT_DEPLOYMENT_GRAPH_TYPE
|
||||
type='default'
|
||||
)
|
||||
|
||||
op.drop_column('releases', 'deployment_tasks')
|
||||
|
|
|
@ -37,7 +37,7 @@ class DeploymentGraph(Base):
|
|||
verbose_name = Column(
|
||||
# not planned to used in business logic and
|
||||
# added to make work with custom graphs convenient
|
||||
String(consts.DEPLOYMENT_GRAPH_NAME_MAX_LEN),
|
||||
String(255),
|
||||
nullable=True)
|
||||
tasks = relationship(
|
||||
'DeploymentGraphTask',
|
||||
|
@ -77,14 +77,14 @@ class DeploymentGraphTask(Base):
|
|||
# not task_id because it could be perceived as fk
|
||||
# and not id because it is not unique inside table
|
||||
task_name = Column(
|
||||
String(consts.DEPLOYMENT_TASK_NAME_MAX_LEN),
|
||||
String(255),
|
||||
index=True,
|
||||
nullable=False)
|
||||
version = Column(
|
||||
String(consts.DEPLOYMENT_TASK_VERSION_MAX_LEN),
|
||||
String(255),
|
||||
nullable=False,
|
||||
server_default=consts.DEPLOYMENT_TASK_DEFAULT_VERSION,
|
||||
default=consts.DEPLOYMENT_TASK_DEFAULT_VERSION)
|
||||
server_default='1.0.0',
|
||||
default='1.0.0')
|
||||
condition = Column(
|
||||
Text,
|
||||
nullable=True)
|
||||
|
@ -102,38 +102,38 @@ class DeploymentGraphTask(Base):
|
|||
name='deployment_graph_tasks_type'),
|
||||
nullable=False)
|
||||
groups = Column(
|
||||
psql.ARRAY(String(consts.DEPLOYMENT_TASK_GROUP_NAME_MAX_LEN)),
|
||||
psql.ARRAY(String(255)),
|
||||
default=[],
|
||||
server_default='{}',
|
||||
nullable=False)
|
||||
tasks = Column(
|
||||
psql.ARRAY(String(consts.DEPLOYMENT_TASK_NAME_MAX_LEN)),
|
||||
psql.ARRAY(String(255)),
|
||||
default=[],
|
||||
server_default='{}',
|
||||
nullable=False)
|
||||
roles = Column( # node roles
|
||||
psql.ARRAY(String(consts.NODE_ROLE_NAME_MAX_LEN)),
|
||||
psql.ARRAY(String(255)),
|
||||
default=[],
|
||||
server_default='{}',
|
||||
nullable=False)
|
||||
# list of Nailgun events on which this task should be re-executed
|
||||
reexecute_on = Column(
|
||||
psql.ARRAY(String(consts.NAILGUN_EVENT_NAME_MAX_LEN)),
|
||||
psql.ARRAY(String(255)),
|
||||
default=[],
|
||||
server_default='{}',
|
||||
nullable=False)
|
||||
refresh_on = Column( # new in 8.0
|
||||
psql.ARRAY(String(consts.NAILGUN_EVENT_NAME_MAX_LEN)),
|
||||
psql.ARRAY(String(255)),
|
||||
default=[],
|
||||
server_default='{}',
|
||||
nullable=False)
|
||||
required_for = Column(
|
||||
psql.ARRAY(String(consts.DEPLOYMENT_TASK_NAME_MAX_LEN)),
|
||||
psql.ARRAY(String(255)),
|
||||
default=[],
|
||||
server_default='{}',
|
||||
nullable=False)
|
||||
requires = Column(
|
||||
psql.ARRAY(String(consts.DEPLOYMENT_TASK_NAME_MAX_LEN)),
|
||||
psql.ARRAY(String(255)),
|
||||
default=[],
|
||||
server_default='{}',
|
||||
nullable=False)
|
||||
|
@ -171,7 +171,7 @@ class ReleaseDeploymentGraph(Base):
|
|||
Integer,
|
||||
primary_key=True)
|
||||
type = Column(
|
||||
String(consts.DEPLOYMENT_GRAPH_TYPE_MAX_LEN),
|
||||
String(255),
|
||||
nullable=False)
|
||||
deployment_graph_id = Column(
|
||||
Integer,
|
||||
|
@ -206,7 +206,7 @@ class PluginDeploymentGraph(Base):
|
|||
Integer,
|
||||
primary_key=True)
|
||||
type = Column(
|
||||
String(consts.DEPLOYMENT_GRAPH_TYPE_MAX_LEN),
|
||||
String(255),
|
||||
nullable=False)
|
||||
deployment_graph_id = Column(
|
||||
Integer,
|
||||
|
@ -237,7 +237,7 @@ class ClusterDeploymentGraph(Base):
|
|||
Integer,
|
||||
primary_key=True)
|
||||
type = Column(
|
||||
String(consts.DEPLOYMENT_GRAPH_TYPE_MAX_LEN),
|
||||
String(255),
|
||||
nullable=False)
|
||||
deployment_graph_id = Column(
|
||||
Integer,
|
||||
|
|
Loading…
Reference in New Issue