Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INFRASYS-6322 - Autoscaling down to original count when no new instan… #15

Merged
merged 1 commit into from
Nov 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions License2Deploy/rolling_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def get_instance_ids_by_requested_build_tag(self, id_list, build):

if not new_instances:
logging.error("There are no instances in the group with build number {0}. Please ensure AMI was promoted.\nInstance ID List: {1}".format(build, id_list))
group_name = self.get_autoscale_group_name()
self.set_autoscale_instance_desired_count(self.calculate_autoscale_desired_instance_count(group_name, 'decrease'), group_name)
exit(self.exit_error_code)

id_ip_dict = self.get_instance_ip_addrs(new_instances)
Expand Down
3 changes: 3 additions & 0 deletions tests/rolling_deploy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ def test_get_all_instance_ids(self):
self.assertEqual(len(instance_ids), len(rslt))

@mock_ec2
@mock_autoscaling
def test_get_instance_ids_by_requested_build_tag(self):
self.setUpEC2()
self.setUpAutoScaleGroup()
conn = boto.connect_ec2()
new_inst = []
res_ids = conn.get_all_instances()
Expand All @@ -197,6 +199,7 @@ def test_get_instance_ids_by_requested_build_tag(self):
if [y for y in name.tags if y == 'BUILD' and name.tags['BUILD'] == '0']:
new_inst.append(name.id)
self.assertEqual(len(self.rolling_deploy.get_instance_ids_by_requested_build_tag(new_inst, 0)), 2)
self.assertRaises(SystemExit, lambda: self.rolling_deploy.get_instance_ids_by_requested_build_tag(new_inst, 1))

@mock_ec2
def test_get_instance_ids_by_requested_build_tag_failure(self):
Expand Down