Create implicit depends from gateway to public subnet.
Depend on any subnet in this template with the same network_id as this network_id, as the gateway implicitly creates a port on that subnet. Fixes bug: #1195599 Change-Id: Ie850a82dce551d46341b1eef7f0208074b72453f
This commit is contained in:
parent
324475bd2a
commit
7056f62160
|
@ -100,13 +100,20 @@ class RouterGateway(quantum.QuantumResource):
|
|||
|
||||
def add_dependencies(self, deps):
|
||||
super(RouterGateway, self).add_dependencies(deps)
|
||||
# depend on any RouterInterface in this template with the same
|
||||
# router_id as this router_id
|
||||
for resource in self.stack.resources.itervalues():
|
||||
# depend on any RouterInterface in this template with the same
|
||||
# router_id as this router_id
|
||||
if (resource.type() == 'OS::Quantum::RouterInterface' and
|
||||
resource.properties.get('router_id') ==
|
||||
self.properties.get('router_id')):
|
||||
deps += (self, resource)
|
||||
# depend on any subnet in this template with the same network_id
|
||||
# as this network_id, as the gateway implicitly creates a port
|
||||
# on that subnet
|
||||
elif (resource.type() == 'OS::Quantum::Subnet' and
|
||||
resource.properties.get('network_id') ==
|
||||
self.properties.get('network_id')):
|
||||
deps += (self, resource)
|
||||
|
||||
def handle_create(self):
|
||||
router_id = self.properties.get('router_id')
|
||||
|
|
|
@ -305,6 +305,10 @@ class QuantumNetTest(HeatTestCase):
|
|||
deps = stack.dependencies[stack['router_interface']]
|
||||
self.assertIn(stack['gateway'], deps)
|
||||
|
||||
# assert the implicit dependency between the gateway and the subnet
|
||||
deps = stack.dependencies[stack['subnet']]
|
||||
self.assertIn(stack['gateway'], deps)
|
||||
|
||||
rsrc.validate()
|
||||
|
||||
ref_id = rsrc.FnGetRefId()
|
||||
|
|
Loading…
Reference in New Issue