-
Notifications
You must be signed in to change notification settings - Fork 16
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
(12.1.0) INFRASYS-6779 - disable the cloud-watch_alarms while rolling deployment. #27
Conversation
801c332
to
82cdfae
Compare
closing the PR and opening it again to re-run the travis build. |
@prabhakar1983 can you do me a favor and move the README/additional test configurations (7fda27e ) out of this pull request? I'd prefer this PR just focus on cloud_watch alarm changes |
@adamjkeller Sure. will ping you once it is done. So, you need this PR to do only cloud_watch_disable_changes and fix for test cases, correct ? |
@prabhakar1983 correct, thank you! |
82cdfae
to
2bf6662
Compare
2bf6662
to
59a2b83
Compare
@adamjkeller Removed the commit that has the documentation. can you pelase review. thank you |
@@ -31,6 +32,13 @@ def aws_conn_elb(region, profile='default'): | |||
return conn | |||
except Exception as e: | |||
logging.error("Unable to connect to region, please investigate: {0}".format(e)) | |||
@staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a newline above the start of this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamjkeller Done.
fefcb06
to
e8ba8d8
Compare
@adamjkeller added Lamda function. Thank you |
48b555a
to
ac30b03
Compare
@adamjkeller Added test cases. |
def test_cloudwatch_filter_function_with_no_alarm(self): | ||
bad_alarm = MetricAlarm(name="xyz_CloudWatchAlarm", metric="CPUUtilization", namespace="AWS/EC2") | ||
cloud_watch_alarms = filter(lambda alarm : self.rolling_deploy.project in alarm.name and self.rolling_deploy.env in alarm.name, [ bad_alarm]) | ||
print("alarms size {}".format(len(cloud_watch_alarms))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to print here or in the method below.
And in python 2.6, you need to add the number from the index into the {}.
So you should do: print("alarms size {0}".format(len(cloud_watch_alarms)))
ac30b03
to
ada65e2
Compare
1e459e4
to
b6be111
Compare
1cba4ae
to
ba5aac7
Compare
ba5aac7
to
168746b
Compare
168746b
to
1a2bcff
Compare
e95616c
to
5094bc4
Compare
5094bc4
to
b6d5cc2
Compare
b6d5cc2
to
a766be3
Compare
@adamjkeller @sbraverman Increased the tests coverage. Can you please review. thank you. |
At this moment, the unit tests are covering the exception in the new methods, but not the success. The reason behind this is that disable_alarm and enable_alarm actions have not been implemented in moto. I would prefer to see particular method mocked out so are able to test a successful run along with a non successful run of the method. |
Ticket created to mock out unit tests properly: INFRASYS-7023 |
+1 |
logging.error("Error while retrieving the list of cloud-watch alarms. Error: {0}".format(e)) | ||
exit(self.exit_error_code) | ||
project_cloud_watch_alarms = filter(lambda alarm: self.project in alarm.name and self.env in alarm.name, all_cloud_watch_alarms) | ||
if len(project_cloud_watch_alarms) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is enough to do:
if not project_cloud_watch_alarms:
+1 |
1+ |
Disabled the alarms before deployment
Enabled the alarms before deployment