Skip to content

Commit

Permalink
Merge f221878 into 7b0b0df
Browse files Browse the repository at this point in the history
  • Loading branch information
taoistmath committed May 17, 2019
2 parents 7b0b0df + f221878 commit ad1475e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions License2Deploy/rolling_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def get_instance_ip_addrs(self, id_list=[]):
def get_all_instance_ids(self, group_name):
""" Gather Instance id's of all instances in the autoscale group """
instances = [i for i in self.get_group_info(group_name)[0].instances]
if len(instances) == 0:
raise Exception("There are no instances in this AutoScalingGroup, please check AutoScalingGroup desired capacity.")
id_list = [instance_id.instance_id for instance_id in instances]
return id_list

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def read(fname):

setup(
name="License2Deploy",
version="0.3.2",
version="0.3.3",
author="Dun and Bradstreet",
author_email="license2deploy@dandb.com",
description="Rolling deploys by changing desired amount of instances AWS EC2 Autoscale Group",
Expand Down
8 changes: 8 additions & 0 deletions tests/rolling_deploy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ def test_get_all_instance_ids(self):
rslt = self.rolling_deploy.get_all_instance_ids(self.GMS_AUTOSCALING_GROUP_STG)
self.assertEqual(len(instance_ids), len(rslt))

@mock_ec2_deprecated
@mock_autoscaling_deprecated
@mock_elb_deprecated
def test_failure_get_all_instance_ids(self):
self.setUpAutoScaleGroup([self.get_autoscaling_configurations(self.GMS_LAUNCH_CONFIGURATION_STG, self.GMS_AUTOSCALING_GROUP_STG)])
self.assertRaises(SystemExit, lambda: self.rolling_deploy.get_all_instance_ids('cool'))


@mock_ec2_deprecated
@mock_autoscaling_deprecated
def test_get_instance_ids_by_requested_build_tag(self):
Expand Down

0 comments on commit ad1475e

Please sign in to comment.