Restriction on length of fuel_version removed
500 error raised in case of cluster created with fuel_version length greater than 30. Restriction on length of field fuel_version removed from DB. Text type used instead String(30) Change-Id: I163b276aed5aa08cfee494751a22682512128060 Closes-Bug: #1316154
This commit is contained in:
parent
c4a39c8894
commit
a72477feea
@ -84,7 +84,7 @@ def upgrade():
|
||||
nullable=True),
|
||||
sa.Column('is_customized', sa.Boolean(), nullable=True),
|
||||
sa.Column(
|
||||
'fuel_version', sa.String(length=30), nullable=False),
|
||||
'fuel_version', sa.Text, nullable=False),
|
||||
sa.ForeignKeyConstraint(['release_id'], ['releases.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
|
@ -19,9 +19,11 @@ from sqlalchemy import Column
|
||||
from sqlalchemy import Enum
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy import Integer
|
||||
from sqlalchemy import String
|
||||
from sqlalchemy import Text
|
||||
from sqlalchemy import Unicode
|
||||
from sqlalchemy.orm import relationship, backref
|
||||
|
||||
from sqlalchemy.orm import backref
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from nailgun import consts
|
||||
|
||||
@ -99,7 +101,7 @@ class Cluster(Base):
|
||||
replaced_deployment_info = Column(JSON, default={})
|
||||
replaced_provisioning_info = Column(JSON, default={})
|
||||
is_customized = Column(Boolean, default=False)
|
||||
fuel_version = Column(String(30), nullable=False)
|
||||
fuel_version = Column(Text, nullable=False)
|
||||
|
||||
def replace_provisioning_info(self, data):
|
||||
self.replaced_provisioning_info = data
|
||||
|
35
nailgun/nailgun/test/unit/test_db_models.py
Normal file
35
nailgun/nailgun/test/unit/test_db_models.py
Normal file
@ -0,0 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2014 Mirantis, Inc.
|
||||
#
|
||||
# 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.
|
||||
|
||||
from random import randint
|
||||
|
||||
from nailgun.db.sqlalchemy.models import Cluster
|
||||
from nailgun.test.base import BaseTestCase
|
||||
|
||||
|
||||
class TestDbModels(BaseTestCase):
|
||||
|
||||
def test_cluster_fuel_version_length(self):
|
||||
fuel_version = 'a' * 1024
|
||||
cluster_data = {
|
||||
'name': 'cluster-api-' + str(randint(0, 1000000)),
|
||||
'fuel_version': fuel_version,
|
||||
'release_id': self.env.create_release(api=False).id
|
||||
}
|
||||
|
||||
cluster = Cluster(**cluster_data)
|
||||
self.db.add(cluster)
|
||||
self.db.commit()
|
Loading…
Reference in New Issue
Block a user