From 905839a8d25a19f7b1b04b39138a5f5f16a1a889 Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Tue, 5 Apr 2016 12:55:30 +0530 Subject: [PATCH] Use RESOLVE translation rules for vpnservice Change-Id: I9049b87c8cd3e240a9493fc0b16cae814ba9cfea Partial-Bug: #1557845 --- .../resources/openstack/neutron/vpnservice.py | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/heat/engine/resources/openstack/neutron/vpnservice.py b/heat/engine/resources/openstack/neutron/vpnservice.py index 86504492e..6ab7deb0a 100644 --- a/heat/engine/resources/openstack/neutron/vpnservice.py +++ b/heat/engine/resources/openstack/neutron/vpnservice.py @@ -155,12 +155,29 @@ class VPNService(neutron.NeutronResource): [self.SUBNET], value_path=[self.SUBNET_ID] ), + translation.TranslationRule( + props, + translation.TranslationRule.RESOLVE, + [self.SUBNET], + client_plugin=self.client_plugin(), + finder='find_resourceid_by_name_or_id', + entity='subnet' + ), translation.TranslationRule( props, translation.TranslationRule.REPLACE, [self.ROUTER], value_path=[self.ROUTER_ID] - ) + ), + translation.TranslationRule( + props, + translation.TranslationRule.RESOLVE, + [self.ROUTER], + client_plugin=self.client_plugin(), + finder='find_resourceid_by_name_or_id', + entity='router' + ), + ] def _show_resource(self): @@ -170,8 +187,8 @@ class VPNService(neutron.NeutronResource): props = self.prepare_properties( self.properties, self.physical_resource_name()) - self.client_plugin().resolve_subnet(props, self.SUBNET, 'subnet_id') - self.client_plugin().resolve_router(props, self.ROUTER, 'router_id') + props['subnet_id'] = props.pop(self.SUBNET) + props['router_id'] = props.pop(self.ROUTER) vpnservice = self.client().create_vpnservice({'vpnservice': props})[ 'vpnservice'] self.resource_id_set(vpnservice['id'])