From cfea078abda4baf71ee1ec6537117b448df1c448 Mon Sep 17 00:00:00 2001 From: Andrew Bays Date: Mon, 12 Sep 2016 15:36:59 -0400 Subject: [PATCH] Don't send empty network stacks to Heat --- .../__methods__/create_networks_and_subnets.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/OPNFV/NetworkServices/Methods.class/__methods__/create_networks_and_subnets.rb b/scripts/OPNFV/NetworkServices/Methods.class/__methods__/create_networks_and_subnets.rb index c1c8c56..e522129 100644 --- a/scripts/OPNFV/NetworkServices/Methods.class/__methods__/create_networks_and_subnets.rb +++ b/scripts/OPNFV/NetworkServices/Methods.class/__methods__/create_networks_and_subnets.rb @@ -41,6 +41,10 @@ def get_networks_template(network_service, parent_service) template_content['resources'][subnet_name]['type'] = 'OS::Neutron::Subnet' end + if template_content['resources'].length == 0 + return nil + end + vnf_networks_template_name = "#{parent_service.name} networks #{parent_service.id}" template = $evm.vmdb('orchestration_template_hot').create( @@ -58,6 +62,13 @@ def deploy_networks(network_service, parent_service) if networks_orchestration == nil networks_template = get_networks_template(network_service, parent_service) + + if networks_template == nil + # No networks to create, so we're done here + $evm.log(:info, "No networks require creation for #{parent_service.name} networks") + exit MIQ_OK + end + networks_orchestration = deploy_networks_stack(network_orchestration_manager, parent_service, networks_template) end