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
fix(organizations): Handle non existent policy #3319
fix(organizations): Handle non existent policy #3319
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3319 +/- ##
==========================================
+ Coverage 85.87% 85.90% +0.02%
==========================================
Files 564 565 +1
Lines 18257 18292 +35
==========================================
+ Hits 15679 15714 +35
Misses 2578 2578 ☔ View full report in Codecov by Sentry. |
except Exception as error: | ||
logger.error( | ||
f"{self.region} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}" | ||
) | ||
finally: | ||
return policy_content_json | ||
return json.loads(policy_content) | ||
|
||
def __list_targets_for_policy__(self, policy_id): |
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.
You have to check in this function if policy_id is not None too.
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.
Done!
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.
Good catch!
Description
Handle JSON policy returned by
describe_policy
when an exception is caught.License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.