From 56b4e61f0ce5b7730ef5e797a397c6b83eac1d1d Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Tue, 4 Mar 2014 19:25:03 +1300 Subject: [PATCH] Remove signal_id from deployments API and model The same information is now available from the deployment's derived config deploy_signal_id input value. Other deployment signal transports might not have a single ID to put in this field so it is better at this stage to remove it from the deployments model and do anything that is required using derived config inputs. partial blueprint hot-software-config Change-Id: I90c85d0ceb9fd67eed640c84348ef4175a6194b6 --- heat/api/openstack/v1/software_deployments.py | 2 +- .../040_software_deployment_no_signal_id.py | 30 +++++++++++++++++++ heat/db/sqlalchemy/models.py | 1 - heat/engine/api.py | 1 - heat/engine/service.py | 3 +- heat/rpc/api.py | 2 -- heat/rpc/client.py | 6 ++-- heat/tests/db/test_migrations.py | 3 ++ heat/tests/test_api_openstack_v1.py | 3 -- heat/tests/test_engine_api_utils.py | 2 -- heat/tests/test_engine_service.py | 5 ++-- heat/tests/test_rpc_client.py | 1 - 12 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 heat/db/sqlalchemy/migrate_repo/versions/040_software_deployment_no_signal_id.py diff --git a/heat/api/openstack/v1/software_deployments.py b/heat/api/openstack/v1/software_deployments.py index a770e4f1f..fa6dfb0cd 100644 --- a/heat/api/openstack/v1/software_deployments.py +++ b/heat/api/openstack/v1/software_deployments.py @@ -71,7 +71,7 @@ class SoftwareDeploymentController(object): Create a new software deployment """ create_data = dict((k, body.get(k)) for k in ( - 'config_id', 'server_id', 'input_values', 'signal_id', + 'config_id', 'server_id', 'input_values', 'action', 'status', 'status_reason')) sd = self.rpc_client.create_software_deployment(req.context, diff --git a/heat/db/sqlalchemy/migrate_repo/versions/040_software_deployment_no_signal_id.py b/heat/db/sqlalchemy/migrate_repo/versions/040_software_deployment_no_signal_id.py new file mode 100644 index 000000000..26f925562 --- /dev/null +++ b/heat/db/sqlalchemy/migrate_repo/versions/040_software_deployment_no_signal_id.py @@ -0,0 +1,30 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# 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. + +import sqlalchemy + + +def upgrade(migrate_engine): + meta = sqlalchemy.MetaData(bind=migrate_engine) + software_deployment = sqlalchemy.Table( + 'software_deployment', meta, autoload=True) + software_deployment.c.signal_id.drop() + + +def downgrade(migrate_engine): + meta = sqlalchemy.MetaData(bind=migrate_engine) + software_deployment = sqlalchemy.Table( + 'software_deployment', meta, autoload=True) + signal_id = sqlalchemy.Column('signal_id', sqlalchemy.String(1024)) + signal_id.create(software_deployment) diff --git a/heat/db/sqlalchemy/models.py b/heat/db/sqlalchemy/models.py index 711191092..091923fc9 100644 --- a/heat/db/sqlalchemy/models.py +++ b/heat/db/sqlalchemy/models.py @@ -297,7 +297,6 @@ class SoftwareDeployment(BASE, HeatBase): nullable=False) input_values = sqlalchemy.Column('input_values', Json) output_values = sqlalchemy.Column('output_values', Json) - signal_id = sqlalchemy.Column(sqlalchemy.String(1024)) tenant = sqlalchemy.Column( 'tenant', sqlalchemy.String(256), nullable=False) action = sqlalchemy.Column('action', sqlalchemy.String(255)) diff --git a/heat/engine/api.py b/heat/engine/api.py index 28b833ced..c55972744 100644 --- a/heat/engine/api.py +++ b/heat/engine/api.py @@ -333,7 +333,6 @@ def format_software_deployment(sd): api.SOFTWARE_DEPLOYMENT_ACTION: sd.action, api.SOFTWARE_DEPLOYMENT_STATUS: sd.status, api.SOFTWARE_DEPLOYMENT_STATUS_REASON: sd.status_reason, - api.SOFTWARE_DEPLOYMENT_SIGNAL_ID: sd.signal_id, api.SOFTWARE_DEPLOYMENT_CONFIG_ID: sd.config.id, } return result diff --git a/heat/engine/service.py b/heat/engine/service.py index f7b82044f..68ac5ac17 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -1128,13 +1128,12 @@ class EngineService(service.Service): @request_context def create_software_deployment(self, cnxt, server_id, config_id, - input_values, signal_id, action, status, + input_values, action, status, status_reason): sd = db_api.software_deployment_create(cnxt, { 'config_id': config_id, 'server_id': server_id, 'input_values': input_values, - 'signal_id': signal_id, 'tenant': cnxt.tenant_id, 'action': action, 'status': status, diff --git a/heat/rpc/api.py b/heat/rpc/api.py index 910cfc46f..3361b6ac4 100644 --- a/heat/rpc/api.py +++ b/heat/rpc/api.py @@ -203,7 +203,6 @@ SOFTWARE_DEPLOYMENT_KEYS = ( SOFTWARE_DEPLOYMENT_SERVER_ID, SOFTWARE_DEPLOYMENT_INPUT_VALUES, SOFTWARE_DEPLOYMENT_OUTPUT_VALUES, - SOFTWARE_DEPLOYMENT_SIGNAL_ID, SOFTWARE_DEPLOYMENT_ACTION, SOFTWARE_DEPLOYMENT_STATUS, SOFTWARE_DEPLOYMENT_STATUS_REASON @@ -213,7 +212,6 @@ SOFTWARE_DEPLOYMENT_KEYS = ( 'server_id', 'input_values', 'output_values', - 'signal_id', 'action', 'status', 'status_reason' diff --git a/heat/rpc/client.py b/heat/rpc/client.py index 8f883765d..424c7861e 100644 --- a/heat/rpc/client.py +++ b/heat/rpc/client.py @@ -404,14 +404,12 @@ class EngineClient(heat.openstack.common.rpc.proxy.RpcProxy): deployment_id=deployment_id)) def create_software_deployment(self, cnxt, server_id, config_id=None, - input_values={}, signal_id=None, - action='INIT', status='COMPLETE', - status_reason=''): + input_values={}, action='INIT', + status='COMPLETE', status_reason=''): return self.call(cnxt, self.make_msg('create_software_deployment', server_id=server_id, config_id=config_id, input_values=input_values, - signal_id=signal_id, action=action, status=status, status_reason=status_reason)) diff --git a/heat/tests/db/test_migrations.py b/heat/tests/db/test_migrations.py index ab573e750..c9960b855 100644 --- a/heat/tests/db/test_migrations.py +++ b/heat/tests/db/test_migrations.py @@ -245,3 +245,6 @@ class TestHeatMigrations(test_migrations.BaseMigrationTestCase, def _check_039(self, engine, data): self.assertColumnIsNullable(engine, 'stack', 'user_creds_id') + + def _check_040(self, engine, data): + self.assertColumnNotExists(engine, 'software_deployment', 'signal_id') diff --git a/heat/tests/test_api_openstack_v1.py b/heat/tests/test_api_openstack_v1.py index 866ea44c0..df2d0b6d0 100644 --- a/heat/tests/test_api_openstack_v1.py +++ b/heat/tests/test_api_openstack_v1.py @@ -3407,7 +3407,6 @@ class SoftwareDeploymentControllerTest(ControllerTest, HeatTestCase): 'action': 'INIT', 'status': 'COMPLETE', 'status_reason': None, - 'signal_id': None, 'config_id': config_id, 'config': '#!/bin/bash', 'name': 'config_mysql', @@ -3436,7 +3435,6 @@ class SoftwareDeploymentControllerTest(ControllerTest, HeatTestCase): 'action': 'INIT', 'status': 'COMPLETE', 'status_reason': None, - 'signal_id': None, 'config_id': config_id} return_value = body.copy() deployment_id = 'a45559cd-8736-4375-bc39-d6a7bb62ade2' @@ -3462,7 +3460,6 @@ class SoftwareDeploymentControllerTest(ControllerTest, HeatTestCase): 'action': 'INIT', 'status': 'COMPLETE', 'status_reason': None, - 'signal_id': None, 'config_id': config_id} return_value = body.copy() deployment_id = 'a45559cd-8736-4375-bc39-d6a7bb62ade2' diff --git a/heat/tests/test_engine_api_utils.py b/heat/tests/test_engine_api_utils.py index 36a58ae22..4ef2cc387 100644 --- a/heat/tests/test_engine_api_utils.py +++ b/heat/tests/test_engine_api_utils.py @@ -804,7 +804,6 @@ class FormatSoftwareConfigDeploymentTest(HeatTestCase): deployment.action = 'INIT' deployment.status = 'COMPLETE' deployment.status_reason = 'Because' - deployment.signal_id = 'http://192.0.2.2/signal' return deployment def test_format_software_config(self): @@ -827,7 +826,6 @@ class FormatSoftwareConfigDeploymentTest(HeatTestCase): self.assertEqual(deployment.server_id, result['server_id']) self.assertEqual(deployment.input_values, result['input_values']) self.assertEqual(deployment.output_values, result['output_values']) - self.assertEqual(deployment.signal_id, result['signal_id']) self.assertEqual(deployment.action, result['action']) self.assertEqual(deployment.status, result['status']) self.assertEqual(deployment.status_reason, result['status_reason']) diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index a43d2f606..042f8c136 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -2584,7 +2584,7 @@ class SoftwareConfigServiceTest(HeatTestCase): self.ctx, config_id) def _create_software_deployment(self, config_id=None, input_values={}, - signal_id=None, action='INIT', + action='INIT', status='COMPLETE', status_reason='', config_group=None, server_id=str(uuid.uuid4()), @@ -2594,7 +2594,7 @@ class SoftwareConfigServiceTest(HeatTestCase): name=config_name) config_id = config['id'] return self.engine.create_software_deployment( - self.ctx, server_id, config_id, input_values, signal_id, + self.ctx, server_id, config_id, input_values, action, status, status_reason) def test_list_software_deployments(self): @@ -2666,7 +2666,6 @@ class SoftwareConfigServiceTest(HeatTestCase): kwargs = { 'config_id': config_id, 'input_values': {'mode': 'standalone'}, - 'signal_id': None, 'action': 'INIT', 'status': 'COMPLETE', 'status_reason': '' diff --git a/heat/tests/test_rpc_client.py b/heat/tests/test_rpc_client.py index ebad18dff..8e3bd5c4a 100644 --- a/heat/tests/test_rpc_client.py +++ b/heat/tests/test_rpc_client.py @@ -246,7 +246,6 @@ class EngineRpcAPITestCase(testtools.TestCase): server_id='9f1f0e00-05d2-4ca5-8602-95021f19c9d0', config_id='48e8ade1-9196-42d5-89a2-f709fde42632', input_values={}, - signal_id=None, action='INIT', status='COMPLETE', status_reason=None)