Skip to content

Commit

Permalink
Merge pull request #543 from QualiSystems/fix-exception-msg
Browse files Browse the repository at this point in the history
update exception message if SG is not found
  • Loading branch information
Costya-Y committed Feb 1, 2021
2 parents b5318e7 + f59987c commit c856443
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def _validate_management_security_group(self, cloud_provider_model, ec2_client,
management_sg_id = cloud_provider_model.aws_management_sg_id
if management_sg_id == '':
return
emsg = (
"Failed to find the AWS management security group {} in the "
"{} region".format(management_sg_id, cloud_provider_model.region)
)
try:
response = ec2_client.describe_security_groups(
GroupIds=[unicode(management_sg_id)])
Expand All @@ -36,14 +40,12 @@ def _validate_management_security_group(self, cloud_provider_model, ec2_client,
for sg in response.get('SecurityGroups', [])
if sg.get('GroupId') == management_sg_id)
if not management_sg_id_found:
raise AutoloadException('Was not able to find the AWS management security group with id {}'.format(
management_sg_id))
raise AutoloadException(emsg)
logger.info(response)

except ClientError as e:
logger.exception(e)
raise AutoloadException('Was not able to find the AWS management security group with id {}'.format(
management_sg_id))
raise AutoloadException(emsg)

def _validate_keypair_location_in_s3(self, cloud_provider_model, logger, s3_session):
logger.info("Checking if keypair storage in S3 exists")
Expand Down

0 comments on commit c856443

Please sign in to comment.