Added a fix to delete a network.

Description:
Deleting network was raising an Exception
"AWS Error: 'NeutronError' - 'Required parameter id not set'"

Issue:
When VPC and Subnet are deleted, neutron core code notifies the change.
But since VPC is already deleted, "create_tags_for_vpc()" doesn't get
VPC ID. Hence it raises AWS Exception when it tries to create tags.

Neutron core code calls "update_network_precommit()" when notifying the
change which eventually calls "create_tags_for_vpc()"

Fix:
Added a check for VPC ID in "create_tags_for_vpc()"

Closes-Bug: #1709046

Change-Id: I6a94911e41bc194b98ddaf51cf9585ac3f4ed07e
This commit is contained in:
Pratik Shah 2017-08-07 19:33:20 +05:30
parent 7613ef6103
commit 3c2185aac3
1 changed files with 3 additions and 2 deletions

View File

@ -279,8 +279,9 @@ class AwsUtils(object):
@aws_exception
def create_tags_for_vpc(self, neutron_network_id, tags_list):
vpc_id = self.get_vpc_from_neutron_network_id(neutron_network_id)
vpc_res = self._get_ec2_resource().Vpc(vpc_id)
vpc_res.create_tags(Tags=tags_list)
if vpc_id is not None:
vpc_res = self._get_ec2_resource().Vpc(vpc_id)
vpc_res.create_tags(Tags=tags_list)
# Subnet Operations
@aws_exception