From 646c08396e637578ab1898750e7c2d79cb096a5f Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam Date: Wed, 18 Mar 2015 15:03:37 +0530 Subject: [PATCH] Fixes SoftwareConfigService to use Resource object Fixes SoftwareConfigService to use Resource object in place resource db api. Implements blueprint versioned-objects Change-Id: Idd9b1215275d899bbf8a7c1a603af9c35dda3008 --- heat/engine/service_software_config.py | 5 +++-- heat/tests/test_engine_service.py | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/heat/engine/service_software_config.py b/heat/engine/service_software_config.py index b7b5a62c3..19d01dbd0 100644 --- a/heat/engine/service_software_config.py +++ b/heat/engine/service_software_config.py @@ -20,8 +20,8 @@ from six.moves.urllib import parse as urlparse from heat.common.i18n import _ from heat.common.i18n import _LI -from heat.db import api as db_api from heat.engine import api +from heat.objects import resource as resource_object from heat.objects import software_config as software_config_object from heat.objects import software_deployment as software_deployment_object from heat.openstack.common import service @@ -72,7 +72,8 @@ class SoftwareConfigService(service.Service): return result def _push_metadata_software_deployments(self, cnxt, server_id): - rs = db_api.resource_get_by_physical_resource_id(cnxt, server_id) + rs = (resource_object.Resource. + get_by_physical_resource_id(cnxt, server_id)) if not rs: return deployments = self.metadata_software_deployments(cnxt, server_id) diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index fcaa78e45..4ba170c37 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -3946,8 +3946,8 @@ class SoftwareConfigServiceTest(common.HeatTestCase): @mock.patch.object(service_software_config.SoftwareConfigService, 'metadata_software_deployments') - @mock.patch.object(service_software_config.db_api, - 'resource_get_by_physical_resource_id') + @mock.patch.object(service_software_config.resource_object.Resource, + 'get_by_physical_resource_id') @mock.patch.object(service_software_config.requests, 'put') def test_push_metadata_software_deployments(self, put, res_get, md_sd): rs = mock.Mock() @@ -3971,8 +3971,8 @@ class SoftwareConfigServiceTest(common.HeatTestCase): @mock.patch.object(service_software_config.SoftwareConfigService, 'metadata_software_deployments') - @mock.patch.object(service_software_config.db_api, - 'resource_get_by_physical_resource_id') + @mock.patch.object(service_software_config.resource_object.Resource, + 'get_by_physical_resource_id') @mock.patch.object(service_software_config.requests, 'put') def test_push_metadata_software_deployments_temp_url( self, put, res_get, md_sd):