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

Bug in handling SES limit check for non-supported region #382

Closed
bergkampsliew opened this issue Jan 31, 2019 · 1 comment
Closed

Bug in handling SES limit check for non-supported region #382

bergkampsliew opened this issue Jan 31, 2019 · 1 comment

Comments

@bergkampsliew
Copy link
Contributor

Related to the fix under issue #375
I realised that @jantman has added PR (which is great idea) on top of my fix. However, I think there's a bug which returned boto exception doesn't contain property "Message" -> ex.response['Error']['Message']
(https://github.com/jantman/awslimitchecker/blob/master/awslimitchecker/services/ses.py#L74)
Hence, exception is thrown and uncaught again.

Version

6.0.1
(and reproducible using develop branch)

Installation Method

pip, without virtualenv

Supporting Software Versions

python 2.7.9
(and also python 3.5.3 when testing with develop branch)

Actual Output

when running command awslimitchecker --region eu-central-1, below exception wasn't handled with stacktrace output.

WARNING:awslimitchecker.services.ses:Skipping SES: An error occurred (AccessDenied) when calling the GetSendQuota operation: Unknown
Traceback (most recent call last):
  File "/root/awslimitchecker/src/awslimitchecker/awslimitchecker/services/ses.py", line 67, in find_usage
    resp = self.conn.get_send_quota()
  File "/root/awslimitchecker/lib/python3.5/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/root/awslimitchecker/lib/python3.5/site-packages/botocore/client.py", line 661, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the GetSendQuota operation: Unknown

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./awslimitchecker", line 11, in <module>
    load_entry_point('awslimitchecker', 'console_scripts', 'awslimitchecker')()
  File "/root/awslimitchecker/src/awslimitchecker/awslimitchecker/runner.py", line 415, in console_entry_point
    r.console_entry_point()
  File "/root/awslimitchecker/src/awslimitchecker/awslimitchecker/runner.py", line 409, in console_entry_point
    res = self.check_thresholds()
  File "/root/awslimitchecker/src/awslimitchecker/awslimitchecker/runner.py", line 310, in check_thresholds
    service=self.service_name)
  File "/root/awslimitchecker/src/awslimitchecker/awslimitchecker/checker.py", line 554, in check_thresholds
    tmp = cls.check_thresholds()
  File "/root/awslimitchecker/src/awslimitchecker/awslimitchecker/services/base.py", line 272, in check_thresholds
    self.find_usage()
  File "/root/awslimitchecker/src/awslimitchecker/awslimitchecker/services/ses.py", line 74, in find_usage
    ex.response['Error']['Message'] == 'Unknown'
KeyError: 'Message'

Expected Output

awslimitchecker gracefully handle the exception and only print short message together with the returned reason from AWS API , without stacktrace.

TrustedAdvisor

Testing Assistance

will make a PR after tested locally

bergkampsliew added a commit to bergkampsliew/awslimitchecker that referenced this issue Jan 31, 2019
jantman added a commit that referenced this issue Feb 15, 2019
Bugfix for handling AccessDenied exception in SES check #382
@jantman
Copy link
Owner

jantman commented Feb 15, 2019

This has been released as 6.1.1 and is now live on PyPI. Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants