From 53615655f2bc2d88c4efcba58b380c9b0f5e9435 Mon Sep 17 00:00:00 2001 From: Nikolay Starodubtsev Date: Tue, 8 Sep 2015 12:06:29 +0300 Subject: [PATCH] Remove legacy network-related code In this patch 'networking' field was removed from environment and environment template models. Also, it was cleared from DB and tests. Change-Id: I372f032a2b1fad1bd9c65016a8d3330bba4bf853 Closes-Bug: #1314192 --- murano/common/server.py | 1 - .../010_remove_unused_networking_column.py | 42 +++++++++++++++++++ murano/db/models.py | 2 - murano/tests/unit/api/v1/test_actions.py | 1 - .../tests/unit/api/v1/test_env_templates.py | 4 -- murano/tests/unit/api/v1/test_environments.py | 3 -- 6 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 murano/db/migration/alembic_migrations/versions/010_remove_unused_networking_column.py diff --git a/murano/common/server.py b/murano/common/server.py index 26f41ab1..32890f6a 100644 --- a/murano/common/server.py +++ b/murano/common/server.py @@ -64,7 +64,6 @@ class ResultEndpoint(object): if environment.description['Objects'] is not None: environment.description['Objects']['services'] = \ environment.description['Objects'].pop('applications', []) - # environment.networking = result.get('networking', {}) action_name = 'Deployment' deleted = False else: diff --git a/murano/db/migration/alembic_migrations/versions/010_remove_unused_networking_column.py b/murano/db/migration/alembic_migrations/versions/010_remove_unused_networking_column.py new file mode 100644 index 00000000..43735f58 --- /dev/null +++ b/murano/db/migration/alembic_migrations/versions/010_remove_unused_networking_column.py @@ -0,0 +1,42 @@ +# 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. + +""" +Revision ID: 010 +Revises: None +Create Date: 2015-09-08 00:00:00.698760 + +""" + +# revision identifiers, used by Alembic. +revision = '010' +down_revision = '009' + +from alembic import op +import sqlalchemy as sa + + +MYSQL_ENGINE = 'InnoDB' +MYSQL_CHARSET = 'utf8' + + +def upgrade(): + op.drop_column('environment', 'networking') + op.drop_column('environment-template', 'networking') + + +def downgrade(): + op.add_column('environment', sa.Column('networking', sa.Text(), + nullable=True)) + op.add_column('environment-template', sa.Column('networking', sa.Text(), + nullable=True)) diff --git a/murano/db/models.py b/murano/db/models.py index 71622a1c..efbdda73 100644 --- a/murano/db/models.py +++ b/murano/db/models.py @@ -66,7 +66,6 @@ class Environment(Base, TimestampMixin): tenant_id = sa.Column(sa.String(36), nullable=False) version = sa.Column(sa.BigInteger, nullable=False, default=0) description = sa.Column(st.JsonBlob(), nullable=False, default={}) - networking = sa.Column(st.JsonBlob(), nullable=True, default={}) sessions = sa_orm.relationship("Session", backref='environment', cascade='save-update, merge, delete') @@ -98,7 +97,6 @@ class EnvironmentTemplate(Base, TimestampMixin): tenant_id = sa.Column(sa.String(36), nullable=False) version = sa.Column(sa.BigInteger, nullable=False, default=0) description = sa.Column(st.JsonBlob(), nullable=False, default={}) - networking = sa.Column(st.JsonBlob(), nullable=True, default={}) def to_dict(self): dictionary = super(EnvironmentTemplate, self).to_dict() diff --git a/murano/tests/unit/api/v1/test_actions.py b/murano/tests/unit/api/v1/test_actions.py index 78794f5c..92eb332b 100644 --- a/murano/tests/unit/api/v1/test_actions.py +++ b/murano/tests/unit/api/v1/test_actions.py @@ -42,7 +42,6 @@ class TestActionsApi(tb.ControllerTest, tb.MuranoApiTestCase): id='12345', name='my-env', version=0, - networking={}, created=fake_now, updated=fake_now, tenant_id=self.tenant, diff --git a/murano/tests/unit/api/v1/test_env_templates.py b/murano/tests/unit/api/v1/test_env_templates.py index 52742774..f2364c83 100644 --- a/murano/tests/unit/api/v1/test_env_templates.py +++ b/murano/tests/unit/api/v1/test_env_templates.py @@ -60,7 +60,6 @@ class TestEnvTemplateApi(tb.ControllerTest, tb.MuranoApiTestCase): expected = {'tenant_id': self.tenant, 'id': 'env_template_id', 'name': 'mytemp', - 'networking': {}, 'version': 0, 'created': timeutils.isotime(fake_now)[:-1], 'updated': timeutils.isotime(fake_now)[:-1]} @@ -161,7 +160,6 @@ class TestEnvTemplateApi(tb.ControllerTest, tb.MuranoApiTestCase): id='12345', name='my-temp', version=0, - networking={}, created=fake_now, updated=fake_now, tenant_id=self.tenant, @@ -213,7 +211,6 @@ class TestEnvTemplateApi(tb.ControllerTest, tb.MuranoApiTestCase): id='12345', name='my-temp', version=0, - networking={}, created=fake_now, updated=fake_now, tenant_id=self.tenant, @@ -246,7 +243,6 @@ class TestEnvTemplateApi(tb.ControllerTest, tb.MuranoApiTestCase): expected = {'tenant_id': self.tenant, 'id': self.uuids[0], 'name': 'env_template_name', - 'networking': {}, 'version': 0, 'created': timeutils.isotime(fake_now)[:-1], 'updated': timeutils.isotime(fake_now)[:-1]} diff --git a/murano/tests/unit/api/v1/test_environments.py b/murano/tests/unit/api/v1/test_environments.py index 48cb0aa8..af34dc4c 100644 --- a/murano/tests/unit/api/v1/test_environments.py +++ b/murano/tests/unit/api/v1/test_environments.py @@ -97,7 +97,6 @@ class TestEnvironmentApi(tb.ControllerTest, tb.MuranoApiTestCase): expected = {'tenant_id': self.tenant, 'id': 'environment_id', 'name': 'my_env', - 'networking': {}, 'version': 0, # TODO(sjmc7) - bug 1347298 'created': timeutils.isotime(fake_now)[:-1], @@ -201,7 +200,6 @@ class TestEnvironmentApi(tb.ControllerTest, tb.MuranoApiTestCase): id='12345', name='my-env', version=0, - networking={}, created=fake_now, updated=fake_now, tenant_id=self.tenant, @@ -294,7 +292,6 @@ class TestEnvironmentApi(tb.ControllerTest, tb.MuranoApiTestCase): id=env_id, name=env_name, version=0, - networking={}, created=fake_now, updated=fake_now, tenant_id=self.tenant,